I have been given a program to create and display binary search tree.i have a doubt regarding display. i want to know should the display function shows the bst like we draw in paper or i have to traverse the in all the 3 possible ways(in,pre,post order and then print the elements in linear fashion.
for ex:- if user input is 20
bst:----> 20
after that i/p is 17,6,8
bst----> 20
17
6 18
8
or simply i traverse the tree in all the 3 orders.
i think its better if i display it in first manner,because it is more clear and understandable.i am new to trees and graphs.i want to implement this program in c without any graphics so please help me how to display using printf statements and format specifiers like \n or \t.
it will be very helpfull if you give me the algorithm/pseudo code or sourcecode for display function or any weblink in which it is given.