Assignment 1 Part2: build_tree function

156 views
Skip to first unread message

shiyi Chen

unread,
Sep 21, 2020, 10:07:53 PM9/21/20
to cmpt-295-sfu
SFU ID: 301366784
Github username: menunnn
Line and file: tree.c

Question: I'm confused about why we have two sets of parameters(one for inorder traversal; the other for preorder traversal) for the build_tree function since we can only return one node when calling the build_tree function.

Question2: Can't find a way to add a tag to my post.

Arrvindh Shriraman

unread,
Sep 22, 2020, 12:44:22 PM9/22/20
to cmpt-295-sfu
You are expected to construct the post order given the inorder and preorder.
Read the assignment instructions and rephrase (if you have a question).

b.minh96

unread,
Sep 22, 2020, 12:52:42 PM9/22/20
to cmpt-295-sfu
The number of parameters passed in the function are not relevant to the fact that one node is returned. 
Note that a node has connections to other nodes (left, right) as well, so when a node is returned you have enough information of a tree. 

shiyi Chen

unread,
Sep 24, 2020, 8:01:03 PM9/24/20
to cmpt-295-sfu

Thanks, I got it.
Reply all
Reply to author
Forward
0 new messages