連結兩個迴圈單鏈表,並保持迴圈連結串列形式
阿新 • • 發佈:2018-12-10
#include "stdafx.h" #include<stdio.h> #include<malloc.h> #include<stdlib.h> typedef int type; typedef struct lnode //定義連結串列結點的資料結構 { int data; struct lnode *next; }Lnode; typedef Lnode node; typedef struct dnode//定義雙鏈表結點的資料結構 { int data; struct dnode *lnext; struct dnode *rnext; }Dnode;
void combinecirlink18(node *h1, node *h2)
{//去掉h2表頭將h2最後一個元素連線到h1第一個元素前
node *h2t = getcirlinktail(h2);
node *p = h1->next;
h2t->next = p;
h1->next = h2->next;
free(h2);
return ;
}