Consider the following list of integers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. Show the binary search tree resulting from inserting the integers in the list.
Consider the following list of integers: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]. Show the binary search tree resulting from inserting the integers in the list.
Using the list from the previous question, show the binary heap tree resulting from using the list as a parameter to the heapify method. Show both the tree and list form.
Consider the two different techniques we used for implementing traversals of a binary tree. Why must we check before the call to preorder when implementing it as a method, whereas we could check inside the call when implementing it as a function?
Modify the buildParseTree and evaluate methods to handle Boolean statements (&&, ||, and !). Remember that ! is a unary operator, so this will complicate your code somewhat.
A threaded binary tree maintains a reference from each node to its successor. Modify the code for a binary search tree to make it threaded, then write a non-recursive inorder traversal method for the threaded binary search tree.
Modify our implementation of the binary search tree so that it handles duplicate keys properly. That is, if a key is already in the tree then the new payload should replace the old rather than add another node with the same key.
Create a binary heap with a limited heap size. In other words, the heap only keeps track of the \(n\) most important items. If the heap grows in size to more than \(n\) items the least important item is dropped.
Using the BinaryHeap class, implement a new class called PriorityQueue. Your PriorityQueue class should implement the constructor plus the enqueue and dequeue methods.