Answered step by step
Verified Expert Solution
Link Copied!

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 two-dimensional 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.
(6 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().
(9 marks)
(d) By using tree and array diagrams, illustrate the effect of inserting a node whose key is
12 into the heap in the array of part (b). You can ignore effects on hPos[].
(6 marks)
(e) Given the following array, describe with the aid of text and tree diagrams how it might
be converted into a heap.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

How satisfi ed are you that your ideas are heard by the team?

Answered: 1 week ago

Question

What aspects would it be impossible to capture?

Answered: 1 week ago

Question

Enhance your words with effective presentation aids

Answered: 1 week ago