Definition at line 17 of file binary_search_tree.cpp.
◆ ~Queue()
◆ createNode()
void Queue::createNode |
( |
int | val | ) |
|
|
inlineprivate |
Definition at line 23 of file circular_queue_using_linked_list.cpp.
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
◆ dequeue()
Definition at line 43 of file circular_queue_using_linked_list.cpp.
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 }
◆ enqueue()
void Queue::enqueue |
( |
int | val | ) |
|
|
inline |
Definition at line 32 of file circular_queue_using_linked_list.cpp.
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()
Definition at line 57 of file circular_queue_using_linked_list.cpp.
57 {
58 if (front == nullptr) {
59 return;
60 }
61 const node* ptr = front;
62 do {
63 std::cout << ptr->data << ' ';
64 ptr = ptr->next;
65 } while (ptr != front);
66 std::cout << '\n';
67 }
◆ front [1/2]
◆ front [2/2]
node* Queue::front = nullptr |
|
private |
◆ rear [1/2]
◆ rear [2/2]
node* Queue::rear = nullptr |
|
private |
The documentation for this class was generated from the following files: