zoukankan      html  css  js  c++  java
  • 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 = 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 }
  • 相关阅读:
    哲学家进餐
    文件系统
    文件读写原理(转)
    数据库join种类
    http与https区别
    数字证书(转)
    B. Rebranding
    扩展欧几里德算法、证明及其应用
    CodeForces 7C Line
    UVALive 7147 World Cup
  • 原文地址:https://www.cnblogs.com/M-D-LUFFI/p/4188414.html
Copyright © 2011-2022 走看看