單迴圈鍊錶 合併

2021-08-28 13:12:56 字數 644 閱讀 9741

#include

#include

#define len sizeof(struct node)

typedef int datatype;

typedef struct node

linklist;

//用尾指標表示帶頭結點的單迴圈鍊錶的建立: 

linklist *hcirl_creat()

rear->next=head;

return rear;}

//單迴圈鍊錶的遍歷運算

void  print_circular( linklist *rb)

printf("\n");

}//建立兩個用尾指標表示的帶頭結點的單迴圈鍊錶a和b 輸出a和b 再利用原空間將b鏈結到a後 合成c 並輸出c

void main()

{ linklist *ra,*rb,*rc,*head;

ra=hcirl_creat();

rb=hcirl_creat();

head=ra->next;

ra->next=rb->next->next;

free(rb->next);

rb->next=head;

rc=rb;

print_circular(rb);

單迴圈鍊錶

頭插 尾插 顯示 頭刪 尾刪 按值插入 按位置插入 查詢 長度 逆序 清除 摧毀 初始化 排序 按位置刪除 按值刪除 可以進一步優化 ifndef sclist h define sclist h include typedef int elementtype typedef enum bool 鍊...

單迴圈鍊錶

乙個遊戲,數到第n人出列 include include include struct people struct people creat struct people head,int n else p struct people malloc sizeof struct people tail ...

拆分單迴圈鍊錶

設單迴圈鍊錶l1,對其遍歷的結果是x1,x2,xn。將該迴圈鍊錶拆分成兩個單迴圈鍊錶l1和l2,使得l1中含有原l1表中序號為奇數的節點,l2中含有原l1表中序號為偶數的節點 include includeusing namespace std template struct node templa...