CS 225 Lecture Notes - Lecture 23: Binary Tree, Empty Set, Wrapper Function
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 #