COMP 250 Study Guide - Midterm Guide: Binary Search Tree, Hash Table, Tree Traversal

122 views6 pages

Document Summary

No justifications are needed: a computer stores a collection of files, each with its own name, a student has a collection of assignments to work on for different classes. Justify your answer: tree traversal algorithms (20 points) Algorithm weirdtraversal(treenode n) if (n!= null) then if (n. key is even) then. Consider the following heap: draw the heap after the insert(4) operation has been performed, as seen in class, draw the heap after the removemin() operation has been performed on the original. Heap (not the one you got in (a)). Consider a binary tree in which each node stores an integer key. Write an algorithm to verify that this tree satisfies the requirements of a valid binary search tree. More specifically, your algorithm should return true when called on the root of a binary tree that satisfies these requirements, and false otherwise. Output: true if n is the root of a valid binary search tree.