C語言實現雙向迴圈鍊錶

2021-10-07 06:41:04 字數 1759 閱讀 7104

題目:要求實現根據要求的數字,使26個字母排序發生變化,例如數字為3,輸出結果:

defghijklmnopqrstuvwxyzabc

同時支援負數,如-3

xyzabcdefghijklmnopqrstuvw

**

/*

* @author: xgh

* @date: 2020-06-16 21:16:26

* @lastedittime: 2020-06-17 10:09:12

* @lasteditors: please set lasteditors

* @description: 雙向迴圈鍊錶

* @filepath: \vs-code-c\.vscode\twowaylinkedlists\twowaylinkedlists.c

*/#include

#include

#include

#define error 0

#define success 1

typedef

char elemtype;

typedef

int statue;

typedef

struct dualnode

dualnode,

*duallinklist;

statue initlist

(duallinklist *l)

;void

showlist

(duallinklist l)

;void

sortting

(duallinklist *l,

int i)

;int

main

(void

)/**

* @description: 顯示鍊錶

* @param

* @return: null

*/void

showlist

(duallinklist l)

while

(p != l->next)

;printf

("\n\n");

}/**

* @description: 初始化雙向鍊錶, 初始化資料a~z

* @param

* @return: reeor: 記憶體分配失敗

* @return: success: 成功

*/statue initlist

(duallinklist *l)

// p用於標識為結點

p =(*l)

;// 生成結點, 初始化資料

for(i=

0; i <

26; i++

)// 構建迴圈, 首元結點的前驅結點為尾結點, 尾結點的後繼結點為首元結點

p->next =

(*l)

->next;

(*l)

->next->perior = p;

return success;

}/**

* @description: 根據使用者輸入數量進行重新排序

* @param

* @return:

*/void

sortting

(duallinklist *l,

int i)

while

(--newdata);}

else

while

(--newdata);}

}

C語言實現雙向迴圈鍊錶

list 雙向迴圈鍊錶,帶頭指標 struct list node 初始化頭指標 void list init head struct list node head 量表是否為空 是返回1,否返回0 int list is empty const struct list node head 鍊錶遍歷...

C語言實現雙向迴圈鍊錶

list 雙向迴圈鍊錶,帶頭指標 struct list node 初始化頭指標 void list init head struct list node head 量表是否為空 是返回1,否返回0 int list is empty const struct list node head 鍊錶遍歷...

c語言實現雙向迴圈鍊錶

雙鏈表實現直通車 單迴圈鍊錶實現直通車 雙鏈表的實現與上面兩者都有大量相似之處。實現功能部分 雙迴圈鍊錶的實現 基於雙鏈表實現,大體區別是尾節點後繼指向頭節點,頭節點的前驅指向尾節點 主要區別還是列印,插入節點 首 中 尾 前插 後插.刪除節點 首 尾 需要特別注意 include include ...