CS 225 Lecture Notes - Lecture 23: Binary Tree, Empty Set, Wrapper Function

25 views3 pages

Document Summary

The average of the next three exams will replace one of the first two exams. // this jumps back and forth by level order, uses a queue. // let"s create the queue template void binarytree::levelorder(treenode *croot) { c b e d / * - + queue q; Q. enqueue(croot); while( !q. isempty()) { // iterative traversal treenode *t = q. dequeue(); // remove if(t!= null) yell(t->data); // at most n nodes in that queue and at most n+1 null, while loop will go for. // o(n) iterations in the while loop, each doing a constant amount of work. // new adt, maps are a particular implementation of dictionary, specific to c++ // we want to store them in arrays, and the locker#s are small integers, so they can easily be used as array indexes, generally easy. // the locker# are keys, and value is name in this case locker #

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers