80 likes | 237 Views
Recitation May 1, 2014. Project 4 due Monday, May 12 Final Exam is May 20 th at 8:00 in 2118 CHE Complete course evaluations!. Announcements. First things first: The ADT you’re working with is the binary search tree- not the nodes inside! The structure “ bst_t is required
E N D
Project 4 due Monday, May 12 • Final Exam is May 20th at 8:00 in 2118 CHE • Complete course evaluations! Announcements
First things first: • The ADT you’re working with is the binary search tree- not the nodes inside! • The structure “bst_t is required • There are 7 required functions for the BST to perform • The data within the nodes of bst_t need to be void pointers: ex. void * data; Project 4
Components provided by the user: • Compare function for keys • Functions ADT creator will write: • new_bst: creates and initializes new bst • free_bst: frees all nodes and arrays used for bst • insert_bst: use compare function to find correct location for insertion and then inserts • find_bst: use compare function to search based on key comparisons • stat_bst: produces number of data items in BST and the height of the BST • *continued) Project 4
start_bst_walk: traverses the tree and puts data in sequential order • See suggestion • next_bst_walk: continues a sorted walk that has already been performed. Walking functions
tree-search.c • Just making changes to existing program • Follow the directions exactly in section 2.1! • parse.c Use of ADT’s
void print_data(data_el *cur) { if (cur->left) print_data(cur->left); printf("%d ", cur->value); if (cur->right) print_data(cur->right); } Wiki link: Recursive Tree Traversal