雙迴圈鍊錶的相關演算法

2021-06-07 03:13:18 字數 847 閱讀 4049

#include

#include

using namespace std;

typedef int elemtype;

typedef struct node

nodetype;

nodetype *create()

return head;

}void dis(nodetype *head)

while(p!=head)

cout<

int len(nodetype *head)

int i=0;

while(p!=head)

return i;}

nodetype *ins(nodetype *head,int i,elemtype x)

nodetype *p,*q,*s;

q=(nodetype *)malloc(sizeof(nodetype));

q->data=x;

p=head->next;

s=head;

for(j=1;j

q->next=p;

q->left=s;

s->next=q;

p->left=q;

return head;}

nodetype *del(nodetype *head,int i)

if(j==1)

nodetype *p,*s,*q;

p=head->next;

s=head;

for(j=1;j

q=p->next;

s->next=q;

q->left=s;

return head;

}

雙迴圈鍊錶

nyoj511移動小球 include include typedef struct node lnode 結點 lnode creat list lnode head,int num 建立不帶頭結點的雙迴圈鍊錶 current data i current rear current pre nul...

雙迴圈鍊錶

include include include include include include using namespace std typedef int elemtype typedef struct node linknode,linklist 鍊錶初始化 linklist initlink...

資料結構(C ) 雙迴圈鍊錶

include allhead.h templateclass dblist templateclass dblistnode dblistnode t x,dblistnode pt null,dblistnode nt null templateclass dblist dblist statu...