list reverse
( list l )
;
typedef
struct node *ptrtonode;
struct node
;typedef ptrtonode list;
/* 定義單鏈表型別 */
#include
#include
typedef
int elementtype;
typedef
struct node *ptrtonode;
struct node
;typedef ptrtonode list;
list read()
;/* 細節在此不表 */
void
print
( list l )
;/* 細節在此不表 */
list reverse
( list l )
;int
main()
/* 你的**將被嵌在這裡 */
513
452
125
431
list reverse
( list l )
//申請乙個結點,依次使用頭插法將l的各個結點使用頭插法接在新申請的結點後面就行
return head->next;
}
6 1 單鏈表逆轉 20分
本題要求實現乙個函式,將給定的單鏈表逆轉。其中list結構定義如下 typedef struct node ptrtonode struct node typedef ptrtonode list 定義單鏈表型別 l是給定單鏈表,函式reverse要返回被逆轉後的鍊錶。裁判測試程式樣例 includ...
6 1 單鏈表逆轉 20分
本題要求實現乙個函式,將給定的單鏈表逆轉。函式介面定義 list reverse list l 其中list結構定義如下 typedef struct node ptrtonode struct node typedef ptrtonode list 定義單鏈表型別 l是給定單鏈表,函式revers...
6 1 單鏈表逆轉 20 分
本題要求實現乙個函式,將給定的單鏈表逆轉。list reverse list l 其中list結構定義如下 typedef struct node ptrtonode struct node typedef ptrtonode list 定義單鏈表型別 l是給定單鏈表,函式reverse要返回被逆轉...