i will uploaded later on.Write a program that implements a binary search tree us
i will uploaded later on.Write a program that implements a binary search tree using a node-pointer implementation. Assume all entries in
the tree will be unique.
struct node {
int data;
node * left;
node * right;
};
Requirements:
1) Implement the following functions:
a) void insert(int data) // creates a new node and inserts it in the correct location in the tree
b) void print_preorder(node * root); // prints the data in a tree using a preorder traversal
c) void print_postorder(node * root); // prints the data in a tree using a postorder traversal
d) void print_inorder(node * root); // prints the data in a tree using an inorder traversal
e) int search(int data) // searches the tree for data. Returns 0 if data is not found, otherwise, returns the
number of nodes visited MUST RUN IN O(logN) time!!!!!!
Leave a Reply