|
node * | t [100] |
|
int | front |
|
int | rear |
|
|
node * | front = nullptr |
|
node * | rear = nullptr |
|
◆ ~Queue()
16 {
17 while (front) {
18 dequeue();
19 }
20 }
◆ createNode()
void Queue::createNode |
( |
int | val | ) |
|
|
inlineprivate |
23 {
25 nn->data = val;
26 nn->next = nullptr;
27 front = nn;
28 rear = nn;
29 }
struct node { int data; int height; struct node *left; struct node *right;} node
for std::queue
Definition avltree.cpp:13
◆ dequeue()
43 {
44 if (front == nullptr) {
45 return;
46 }
47 const node*
const n = front;
48 if (front == rear) {
49 front = nullptr;
50 rear = nullptr;
51 } else {
52 front = front->next;
53 rear->next = front;
54 }
55 delete n;
56 }
Definition binary_search_tree.cpp:11
◆ enqueue()
void Queue::enqueue |
( |
int | val | ) |
|
|
inline |
32 {
33 if (front == nullptr || rear == nullptr) {
34 createNode(val);
35 } else {
37 nn->data = val;
38 rear->next = nn;
39 nn->next = front;
40 rear = nn;
41 }
42 }
◆ traverse()
57 {
58 if (front == nullptr) {
59 return;
60 }
61 const node* ptr = front;
62 do {
64 ptr = ptr->next;
65 } while (ptr != front);
67 }
The documentation for this class was generated from the following files: