首页 > 代码库 > Doubly_Linked_List
Doubly_Linked_List
1 #include <iostream> 2 #include <string> 3 #include <cstdio> 4 #include <cstdlib> 5 6 using namespace std; 7 8 struct Dulist 9 {10 int data;11 Dulist *prior;12 Dulist *next;13 };14 Dulist *head;15 void Init_Node()16 {17 head->data = http://www.mamicode.com/0;18 head->prior = NULL;19 head->next = NULL;20 }21 22 void Insert_Node(Dulist *Q, int data, int index)23 {24 Dulist *p = (Dulist *)malloc(sizeof(Dulist));25 p = head;26 for (int i = 0; i < index; i++)27 {28 p = p->next;29 }30 Q->prior = p;31 p->next->prior = Q;32 Q->next = p->next;33 p->next = Q;34 }35 36 void Delete_Node(int index)37 {38 Dulist *p = (Dulist *)malloc(sizeof(Dulist));39 p = head;40 for (int i = 0; i < index; i++)41 {42 p = p->next;43 }44 p->prior->next = p->next;45 p->next->prior = p->prior;46 }47 48 int main()49 {50 51 }
Doubly_Linked_List
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。