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 1: 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 1 :
37914821610232011793182111
Array 2 :
51310422011124045262818146
Problem 2: 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.
14826119467218116317654
Then, draw the heap after the smallest element is removed.
Problem 3: 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 4: 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)52867314
b)41739856
c)69415328
Problem 5: Clearly explain the benefits of keeping a BST balanced. Be specific.
Problem 6: 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)327169485
b)42139758
Problem 7: Consider the following BST:a) Write the pre-order sequence of integers.b) Write the Java code that deletes the number 5 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 10. Do not write the general remove method...just write the code that specifically removes 5 from this tree.Problem 8: 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)
Problem 1 : For each array of elements given

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!