Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with C++ question please Question 1 : 7 points A heap is a special kind of tree. The minimum value is always stored

Need help with C++ question please

image text in transcribed

Question 1 : 7 points A heap is a special kind of tree. The minimum value is always stored at the root of the tree. This tree is specifically designed to make finding the minimum as fast as possible. A heap is normally stored in an array. The array has the following properties. The Root is at index 0 The Parent of the node at index n is at index floor ((n - 1)/2) The Left Child of the node at index n is at (n+1)* 2 - 1 The Right Child of the node at index n is at index (n +1)* 2 (a) (1 point) What index is the parent of the value at index 7? (b) (1 point) What index is the parent of the value at index 8? (c) (1 point) What index is the left child of the value at index 4? (d) (1 point) What index is the right child of the value at index 4? (e) (3 points) Draw the tree representation of the below array. Index 0 1 2 3 4 5 6 Value 495 12 10 6 8

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_2

Step: 3

blur-text-image_3

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago