Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( a ) Explain the terms: i ) priority queue ii ) complete binary tree iii ) heap iv ) heap condition ( b )
a Explain the terms:
i priority queue
ii complete binary tree
iii heap
iv heap condition
b Draw the following heap array as a twodimensional binary tree data structure:
Also, assuming another array hPos is used to store the position of each key in the
heap, show the contents of hPos for this heap.
marks
c Write in pseudocode the algorithms for the siftUp and insert operations on a heap
and show how hPos would be updated in the siftUp method if it was to be included
in the heap code. Also write down the complexity of siftUp
marks
d By using tree and array diagrams, illustrate the effect of inserting a node whose key is
into the heap in the array of part b You can ignore effects on hPos
marks
e Given the following array, describe with the aid of text and tree diagrams how it might
be converted into a heap.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started