-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.hpp
More file actions
39 lines (36 loc) · 1.02 KB
/
Node.hpp
File metadata and controls
39 lines (36 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* SET07109 Coursework 2: Implementing a binary search tree (Part B)
* -----------------------------------------------------------------
* struct declaration for Node
* author: Vinh Phat Tu (40507973)
* last date of modification: April 2021
*/
#pragma once
#include "Identifier.hpp"
#include <memory>
/*
* Struct: Node
* ------------
* stores a node in a binary tree:
* - identifier: smart pointer to an Identifier object
* - left_node: smart pointer to the left node
* - right_node: smart pointer to the right node
*/
struct Node
{
/*
* Method: Node - Constructor
* ----------------------------
* constructor for Node struct
* - assigns Identifier pointer
*
* parameter: identifier - smart pointer to an Identifier
*/
Node(std::shared_ptr<Identifier> identifier)
{
this->identifier = identifier;
}
std::shared_ptr<Identifier> identifier;
std::unique_ptr<Node> left_node;
std::unique_ptr<Node> right_node;
};