DATA STRUCTURE PROBLEM 1. Consider the following MinHeap: When implemented with
ID: 3580898 • Letter: D
Question
DATA STRUCTURE PROBLEM
1. Consider the following MinHeap:
When implemented with an array rather than a tree, what element value would be found in index position 3?
2. Consider the following BinarySearchTree t:
What pile of code would have created this tree in memory?
3. Consider the following MaxHeap h:
What pile of code would have created this heap in memory?
4. Consider the following MinHeap h:
What pile of code would have created this heap in memory?
5. A message was used to create the following Huffman Tree:
What do you know about the message used to build this Huffman Tree?
A.12 (2 (9Explanation / Answer
1> answer D. the array will be -> 1 , 4, 8, 10, 12, so the element at index 3 is 10.
2> answer A : t.insert( 5 ); t.insert( 3 ); t.insert( 4 ); t.insert( 0 ); t.insert( 15 ); This will be the order of insertion so as make that tree
3> answer E : All of the piles of program would have made the MaxHeap h shown above. Because after the insertion, the tree is heapified. so no matter what is the order of insertion, the final tree will look the same always so as to satisfy the heap property.
4> answer B : All of the piles of code shown here would have made the MinHeap shown above. The reason is same as above.
5> answer A : The message had more A's than D's. Since the tree builds from the bottom with the least frequency elements, therefore we can say that the frequency of A is greater than the D.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.