C++ binary search tree array implementation

Hello, i'm writing a project for a class. I need a step in the right direction as my professor is a little slow replying back to me. I'm still trying to learn c++ so please bear with me. The first part of the code i'm working on is the insert function:

Class/Header:
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
40
41
#ifndef _BST_HPP_
#define _BST_HPP_
#include <stdint.h>
#include <stdio.h>
#include <iostream>
#include "Node.hpp"

using namespace std;

#define MAX_TREE_SIZE 10000

template <typename T>
class BST{
private:
  Node<T>* tree[MAX_TREE_SIZE];
  void print_preorder_helper(uint16_t);
  void print_postorder_helper(uint16_t);
  void print_inorder_helper(uint16_t);
  bool search_helper(uint16_t, T);
public:
  BST();
  ~BST();
  void insert(T);
  bool search(T);
  void clear();
  void print_preorder();
  void print_postorder();
  void print_inorder();
  Node<T>* _get_node_at(uint16_t);
};

*/
template <typename T>
class Node{
private:
  T value;
public:
  Node<T>(T);
  T getValue();
  void setValue(T);
};


What is expected of me:

@brief Insert specified value into BST while maintaining
order; the following logic should be applied when inserting
a new node:
if value < valueof(parent)
follow lChild
else
follow rChild
@param value, value to insert
@return NA


What i have currently:
1
2
3
4
5
6
7
8
9
template <typename T>
void BST<T>::insert(T value)
{
 if(tree[0] == NULL)
  {
   tree[0] = new Node<T>(value);
   tree[0]->setValue(value);
  }
}


the next two scenarios would be for when the next node is greater than or less than the current node. how would i go about this? thank you in advance.
Topic archived. No new replies allowed.