How do I build a Binary Tree Bottom Up from a given Text File in c#

Viewed 28

Theres 3 lines in the text file separated by a comma, where the last line is the root, I've only managed to build the tree from the top down but not from the bottom up. The text file shows the contents of the tree in layers from left to right where each line is a layer. The tree is perfectly balanced

TextFile contents:

Line 1- 53,12,8,19 Line 2- 30,4 Line 3- 2

The resultant tree should be printed in pre-order: 2,30,53,12,4,8,19

0 Answers
Related