|
Binary Search Tree (C++)
|
Represents an explicit stack used to support non-recursive tree operations. More...
#include <Stack.h>
Public Member Functions | |
| Stack () | |
| Constructs an empty Stack. | |
| ~Stack () | |
| Destroys the Stack. | |
| void | push (Node *n) |
| Pushes a node onto the stack. | |
| Node * | pop () |
| Removes and returns the node at the top of the stack. | |
| bool | isEmpty () const |
| Checks whether the stack is empty. | |
Represents an explicit stack used to support non-recursive tree operations.
The Stack class implements a simple stack structure composed of node pointers. It is used to support traversal and deletion operations within a binary search tree, including non-recursive in-order traversal and tree destruction.
The Stack does not assume ownership of the tree nodes it stores; it manages only the stack nodes required to support these operations.
Supported operations include:
|
inline |
| Stack::~Stack | ( | ) |
| bool Stack::isEmpty | ( | ) | const |
| Node * Stack::pop | ( | ) |
Removes and returns the node at the top of the stack.
Pops a node off the stack and returns the stored tree node pointer.
Definition at line 40 of file Stack.cpp.
| void Stack::push | ( | Node * | n | ) |