1 / 8

Recitation May 1, 2014

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

jamil
Télécharger la présentation

Recitation May 1, 2014

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Recitation May 1, 2014

  2. Project 4 due Monday, May 12 • Final Exam is May 20th at 8:00 in 2118 CHE • Complete course evaluations! Announcements

  3. 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

  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

  5. 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

  6. tree-search.c • Just making changes to existing program • Follow the directions exactly in section 2.1! • parse.c Use of ADT’s

  7. 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

More Related