time limit: 1000ms memory limit: 65536k
輸入多個整數,以-1作為結束標誌,順序建立乙個帶頭結點的單鏈表,之後對該單鏈表的資料進行逆置,並輸出逆置後的單鏈表資料。
輸入多個整數,以-1作為結束標誌。
輸出逆置後的單鏈表資料。
12 56 4 6 55 15 33 62 -1
62 33 15 55 6 4 56 12
不得使用陣列。
#include #include#includeusing namespace std;
struct node
;int main()
p=head->next;
head->next=null;
q=p->next;
while(p!=null)
p=head->next;
while(p!=null)
else
printf("%d\n",p->data);
p=p->next;
}return 0;
}
資料結構實驗之鍊表三 鍊錶的逆置
資料結構實驗之鍊表三 鍊錶的逆置 輸入多個整數,以 1作為結束標誌,順序建立乙個帶頭結點的單鏈表,之後對該單鏈表的資料進行逆置,並輸出逆置後的單鏈表資料。輸入多個整數,以 1作為結束標誌。輸出逆置後的單鏈表資料。12 56 4 6 55 15 33 62 1 62 33 15 55 6 4 56 1...
資料結構實驗之鍊表三 鍊錶的逆置
time limit 1000ms memory limit 65536k 輸入多個整數,以 1作為結束標誌,順序建立乙個帶頭結點的單鏈表,之後對該單鏈表的資料進行逆置,並輸出逆置後的單鏈表資料。輸入多個整數,以 1作為結束標誌。輸出逆置後的單鏈表資料。12 56 4 6 55 15 33 62 1...
資料結構實驗之鍊表三 鍊錶的逆置
abc defg hijk lm f 資料結構實驗之鍊表三 鍊錶的逆置 time limit 1000msmemory limit 65536kb64bit io format lld llu submit status practice sdutoj 2118 description 輸入多個整數...