Question: Problem 1 : For each array of elements given below, identify whether or not the array is a heap. If not, explain in detail why
Problem : For each array of elements given below, identify whether or not the array is a heap. If not, explain in detail why the array cannot be a heap.
Array :
Array :
Problem : Assume we have a heap that guarantees the smallest element is always at the top and that the heap is initially empty. Draw a diagram of the heap that is constructed when the following integers are added to the heap, one by one, in the order given.
Then, draw the heap after the smallest element is removed.
Problem : Write a recursive method in Java that prints a Binary Search Tree BST in reverse order. For integers, this means you are printing the number in descending order.
Assume you are writing the method in the BST class and have access to the Node class with the fields: element, left and right.
Problem : For each of the following sequences of numbers:
Draw the BST that is created if you add the numbers one at a time in the order given.
Identify whether the completed BST is also an AdelsonVelsky Landis AVL tree.
If the BST is not an AVL tree, identify all unbalanced nodes and explain why each is unbalanced.
a
b
c
Problem : Clearly explain the benefits of keeping a BST balanced. Be specific.
Problem : For each of the following sequences of numbers:
Draw the AVL tree that is created if you add the numbers one at a time in the order given.
Clearly identify each rotation.
a
b
Problem : Consider the following BST:a Write the preorder sequence of integers.b Write the Java code that deletes the number from the tree. Assume there is a Node class with the fields: element, right and left. Also assume there is a root variable the references the Do not write the general remove method...just write the code that specifically removes from this tree.Problem : For each data structure listed below, identify one benefit and one drawback of using the data structure for a particular problem.a arrayb linked listc stackd heape hash tablef binary search tree balanced
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
