Assignment 1 freeing tree

124 views
Skip to first unread message

Trevor Bonas

unread,
Sep 18, 2020, 11:12:18 PM9/18/20
to cmpt-295-sfu

SFU ID: tbonas
Github username: trevorbonas
Line and file: Line 94 tree.c
Expected behavior: Frees tree created by build_tree_string
Observed behavior: Frees tree created by build_tree_string
Question:

At the bottom of the description for assignment 1 it says we must make sure our programs don't have any leaks, so I created a tree freeing function, de_tree, and used it in build_tree_string, the only place in the tests that a tree is built.

Valgrind says it works fine, and all changes are in the remote repo, I was just wondering if the change I made was appropriate: build_tree_string calls print_postorder_string, which takes a Node* as input, given by passing a call to my written function build_tree. To properly free the tree I called build_tree before print_postorder_string, stored the result in a Node* and passed that Node* into print_postorder_string. Is this change okay?

Arrvindh Shriraman

unread,
Sep 19, 2020, 1:23:26 AM9/19/20
to cmpt-2...@googlegroups.com
Short answer: should be ok.
Please read "Assignment 2 Freeing Tree Memory"  message thread for more details
Reply all
Reply to author
Forward
0 new messages