The following code lists the nodes in a binary tree in two different orders:
preorder:C,B,A,E,D,F,H
postorder:A,B,D,H,F,E,C
Draw the binary tree.
The answer is :
C
/ \
B E
/ / \
A D F
/
H
so, my question is how should i think or is there any quick method to get the above answer?I know how to draw a binary tree by its sequence but become confuse in the other way round just like this question.Please help me as soon as possible.thanks.
xonxon -4 Light Poster
Narue 5,707 Bad Cop Team Colleague
nucleon 114 Posting Pro in Training
nucleon 114 Posting Pro in Training
dgkris 0 Newbie Poster
mrnutty 761 Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.