鍊錶綜合問題

2021-09-24 13:43:30 字數 924 閱讀 6956

關於帶表頭鍊錶建立,順序排序各節點,順序插入節點,刪除節點,合併的操作。

#include

#include

#define x sizeof(xzx)

typedef

struct student //結構體變數

xzx;

void

creat

(xzx *head)

//建立鍊錶

free

(p1)

; p2->next=

null;}

void

paixu

(xzx *head)

//排序函式

} end=p1;}}

void

charu

(xzx *head)

//順序插入乙個節點

else

p->next=n;

n->next=q;}}

void

del(xzx *head)

//刪除指定節點

p3->next=p2;

free

(p1);}

void

print

(xzx *head)

//輸出鍊錶

}xzx *

hebin

(xzx *head1,xzx *head2)

//合併鍊錶

else}if

(p1==

null

) p3->next=p2;

if(p2==

null

) p3->next=p1;

return head1;

}int

main()

//主函式

鍊錶的綜合使用

鍊錶的使用 建立 include 分配空間 define null 0 define len sizeof struct student struct student 定義結構體 int n 全域性變數,記錄結點個數 struct student creat void p2 next null re...

l鍊錶的綜合操作

define null 0 define len sizeof struct student struct student main p2 next null printf head 0x,last 0x n head,p1 鍊錶生成結束 輸出鍊錶 p1 head printf nnow the n...

C語言鍊錶綜合操作

預處理命令 include include define len sizeof struct student define format ld,f define p format ld 5.1f n define null 0 構造結構體 struct student 構造乙個結構體型別 int n...