The following strings are inserted, one at a time and in the order given, into a
ID: 3737213 • Letter: T
Question
The following strings are inserted, one at a time and in the order given, into an initially empty heap:
"Fred", "Terri", "Bob", "Wilma", "Zelda", "Pam", "Ron"
The resulting heap array would be:
a. Zelda Ron Wilma Fred Terri Bob Pam
Zelda Ron Wilma Bob Pam Fred Terri
Zelda Wilma Ron Fred Terri Pam Bob
Yellow White Red Green Violet Blue Orange
none of the above
a. Zelda Ron Wilma Fred Terri Bob Pam
b.Zelda Ron Wilma Bob Pam Fred Terri
c.Zelda Wilma Ron Fred Terri Pam Bob
d.Yellow White Red Green Violet Blue Orange
e.none of the above
Explanation / Answer
Answer)
According to the alphabetical series we take the first number of the equivalent word letter. Thus, the words have a single digit number to represent them as:
"Fred" 2
"Terri" 5
"Bob" 1
"Wilma" 6
"Zelda" 7
"Pam" 3
"Ron" 4
This means that "Fred", "Terri", "Bob", "Wilma", "Zelda", "Pam", "Ron", has been inserted into a initially empty heap.
We have created a max heap and thus, the output in array after inserting in the heap is:
7,6,4,2,5,3,1
Zelda, Wilma, Ron, Fred, Terri, Pam, Bob
The above output matches with the option:
c. Zelda Wilma Ron Fred Terri Pam Bob
and thus this will be the answer.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.