You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
454 B
C++
27 lines
454 B
C++
#include "Node.h"
|
|
|
|
using namespace std;
|
|
void Node::insert(string key) {
|
|
Node * new_node = new Node(key);
|
|
if (this->key > key)
|
|
this->left_child = new_node;
|
|
else
|
|
this->right_child = new_node;
|
|
}
|
|
|
|
std::string Node::get_key() {
|
|
return this->key;
|
|
}
|
|
|
|
Node * Node::get_left_child() {
|
|
return this->left_child;
|
|
}
|
|
|
|
Node * Node::get_right_child() {
|
|
return this->right_child;
|
|
}
|
|
|
|
Node::Node(string key) {
|
|
this->key = key;
|
|
}
|