Binary Search Tree (C++)
Loading...
Searching...
No Matches
Node.cpp
Go to the documentation of this file.
1
13
14#include "Node.h"
15
20Node::Node(int v) : value(v), left(nullptr), right(nullptr) {}
21
25int Node::getValue() const {
26 return value;
27}
28
32void Node::setValue(int v) {
33 value = v;
34}
35
40 return left;
41}
42
47 left = l;
48}
49
53 return right;
54}
55
60 right = r;
61}
Declaration of the Node class.
Node * getRight() const
Returns a pointer to the right child node.
Definition Node.cpp:52
Node(int value)
Constructs a Node with the specified integer value.
Definition Node.cpp:20
void setLeft(Node *left)
Sets the pointer to the left child node.
Definition Node.cpp:46
void setValue(int value)
Sets the stored integer value.
Definition Node.cpp:32
void setRight(Node *right)
Sets the pointer to the right child node.
Definition Node.cpp:59
Node * getLeft() const
Returns a pointer to the left child node.
Definition Node.cpp:39
int getValue() const
Returns the stored integer value.
Definition Node.cpp:25