|
Binary Search Tree (C++)
|
Represents a node within a binary search tree. More...
#include <Node.h>
Public Member Functions | |
| Node (int value) | |
| Constructs a Node with the specified integer value. | |
| int | getValue () const |
| Returns the stored integer value. | |
| void | setValue (int value) |
| Sets the stored integer value. | |
| Node * | getLeft () const |
| Returns a pointer to the left child node. | |
| void | setLeft (Node *left) |
| Sets the pointer to the left child node. | |
| Node * | getRight () const |
| Returns a pointer to the right child node. | |
| void | setRight (Node *right) |
| Sets the pointer to the right child node. | |
Represents a node within a binary search tree.
The Node class represents the fundamental unit of an iterative, pointer-based binary search tree. Each node maintains self-referential raw pointers to its left and right child nodes and stores a single integer data value.
Encapsulation is enforced through data hiding. All data members are declared as private and may only be accessed or modified through public accessor methods.
| Node::Node | ( | int | v | ) |
| Node * Node::getLeft | ( | ) | const |
| Node * Node::getRight | ( | ) | const |
| int Node::getValue | ( | ) | const |
| void Node::setLeft | ( | Node * | l | ) |
| void Node::setRight | ( | Node * | r | ) |
| void Node::setValue | ( | int | v | ) |