In Progress

Binary Search Tree

Read about hundred non-duplicated integers (<100) from a text file (numbers on one line like example below) and insert them into a Binary Search Tree one by one. Then print the entire tree on the screen console in consecutive rows such that

(1) Tree is aligned horizontally with the root at column 1 from left and other nodes in right columns according to their depths.

(2) The smallest node comes at the first row and the largest node at the final row. Other nodes are listed in order in consecutive rows, i.e., the nodes are sorted vertically in the print

(3) In front of each node in its row, print a number of "-" corresponding to its depth in the tree. Also, the depth value should be printed in the leftmost column (column 0).

For example: with the input numbers 3, 1, 8, 83, 6, 90, 80 the tree print is

(1) -1

(0) 3

(2) -- 6

(1) - 8

(3) --- 80

(2) -- 83

(3) --- 90

Need proper comments and explanation. Please contact me if you any questions.

Skills: C++ Programming

See more: tree programming, tree node, tree insert, tree in order, tree binary search, sorted binary tree, search in tree, search in binary tree, search binary tree, search binary search tree, search binary, search a tree, programming tree, programming in binary, order of tree, order of binary tree, order of binary search, number of nodes in a tree, node programming, node of a tree, node in tree, is binary search tree, insert in binary tree, example of binary search tree, example of binary search

About the Employer:
( 4 reviews ) Indianapolis, United States

Project ID: #6634172

1 freelancer is bidding on average $10 for this job


Hired by the Employer

$10 USD in 1 day
(0 Reviews)