|
Binary Search Tree (C++)
|
Represents an explicit queue used to support non-recursive tree operations. More...
#include <Queue.h>
Public Member Functions | |
| Queue () | |
| Constructs an empty queue. | |
| ~Queue () | |
| Destroys the Queue. | |
| void | enqueue (Node *n) |
| Adds a node to the end of the queue. | |
| Node * | dequeue () |
| Removes and returns the node at the front of the queue. | |
| bool | isEmpty () const |
| Checks whether the queue is empty. | |
Represents an explicit queue used to support non-recursive tree operations.
The Queue class implements a simple queue structure composed of node pointers. It is used to support non-recursive, level-order traversal operations within a binary search tree.
The Queue does not assume ownership of the tree nodes it stores; it manages only the queue nodes required to support these operations.
Supported operations include:
|
inline |
| Queue::~Queue | ( | ) |
Destroys the Queue.
Destroys the queue by removing all remaining nodes.
Definition at line 21 of file Queue.cpp.
| Node * Queue::dequeue | ( | ) |
Removes and returns the node at the front of the queue.
Dequeues the front element and returns the associated tree node pointer.
Definition at line 45 of file Queue.cpp.
| void Queue::enqueue | ( | Node * | n | ) |
Adds a node to the end of the queue.
| n | Pointer to the Node added to the rear of the queue. |
Appends a node to the queue.
Definition at line 31 of file Queue.cpp.
| bool Queue::isEmpty | ( | ) | const |