◆ double_linked_list()
double_linked_list::double_linked_list |
( |
| ) |
|
|
inline |
◆ insert()
void double_linked_list::insert |
( |
int | x | ) |
|
21 {
23 if (start != NULL) {
24 while (t->next != NULL) {
25 t = t->next;
26 }
28 t->next = n;
29 n->prev = t;
30 n->val = x;
31 n->next = NULL;
32 } else {
34 n->val = x;
35 n->prev = NULL;
36 n->next = NULL;
37 start = n;
38 }
39}
struct node { int data; int height; struct node *left; struct node *right;} node
for std::queue
Definition avltree.cpp:13
Definition binary_search_tree.cpp:11
◆ remove()
void double_linked_list::remove |
( |
int | x | ) |
|
41 {
43 while (t != NULL && t->val != x) {
44 t = t->next;
45 }
46 if (t == NULL) {
47 return;
48 }
49 if (t->prev == NULL) {
50 if (t->next == NULL) {
51 start = NULL;
52 } else {
53 start = t->next;
54 start->prev = NULL;
55 }
56 } else if (t->next == NULL) {
57 t->prev->next = NULL;
58 } else {
59 t->prev->next = t->next;
60 t->next->prev = t->prev;
61 }
62 delete t;
63}
◆ reverseShow()
void double_linked_list::reverseShow |
( |
| ) |
|
89 {
91 while (t != NULL && t->next != NULL) {
92 t = t->next;
93 }
94 while (t != NULL) {
96 t = t->prev;
97 }
98}
◆ search()
void double_linked_list::search |
( |
int | x | ) |
|
65 {
67 int found = 0;
68 while (t != NULL) {
69 if (t->val == x) {
71 found = 1;
72 break;
73 }
74 t = t->next;
75 }
76 if (found == 0) {
78 }
79}
◆ show()
void double_linked_list::show |
( |
| ) |
|
81 {
83 while (t != NULL) {
85 t = t->next;
86 }
87}
The documentation for this class was generated from the following file:
- data_structures/doubly_linked_list.cpp