码迷,mamicode.com
首页 > 其他好文 > 详细

Doubly_Linked_List

时间:2014-12-27 15:12:16      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

 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 = 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

标签:

原文地址:http://www.cnblogs.com/M-D-LUFFI/p/4188414.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!