SlideShare a Scribd company logo
1 of 1
Download to read offline
Suppose that a heap stores 210 elements. What is its height? (show work with diagrams)
Solution
A binary heap is a complete binary tree which satisfies the heap ordering property.
The maximum number of nodes at level l of the heap is 2l.
Therefore a heap of height h stores at most 20+ 21+:+ 2h= 2h +1 – 1 node.
If h= 6, then the heap stores at most 27 – 1 =127 elements, which is not enough .so the heap must
be of height 7,since for height 7 a heap can store 28 – 1 =255. The last level of the heap is not
full.

More Related Content

More from neerajsachdeva33

The first part of the assignment involves creating very basic GUI co.pdf
The first part of the assignment involves creating very basic GUI co.pdfThe first part of the assignment involves creating very basic GUI co.pdf
The first part of the assignment involves creating very basic GUI co.pdf
neerajsachdeva33
 
Please distinguish between the .h and .cpp file, create a fully work.pdf
Please distinguish between the .h and .cpp file, create a fully work.pdfPlease distinguish between the .h and .cpp file, create a fully work.pdf
Please distinguish between the .h and .cpp file, create a fully work.pdf
neerajsachdeva33
 
I dont understand numbers 14 and 15, please help.. PROBLEM BAS .pdf
I dont understand numbers 14 and 15, please help.. PROBLEM BAS .pdfI dont understand numbers 14 and 15, please help.. PROBLEM BAS .pdf
I dont understand numbers 14 and 15, please help.. PROBLEM BAS .pdf
neerajsachdeva33
 
Graphs A and B depict two ways of determining how molecules (in this .pdf
Graphs A and B depict two ways of determining how molecules (in this .pdfGraphs A and B depict two ways of determining how molecules (in this .pdf
Graphs A and B depict two ways of determining how molecules (in this .pdf
neerajsachdeva33
 
Comment upon Charles Greene’s (1975) suggestion that follower perfor.pdf
Comment upon Charles Greene’s (1975) suggestion that follower perfor.pdfComment upon Charles Greene’s (1975) suggestion that follower perfor.pdf
Comment upon Charles Greene’s (1975) suggestion that follower perfor.pdf
neerajsachdeva33
 

More from neerajsachdeva33 (20)

We are interested in whether the proportions of female suicide victim.pdf
We are interested in whether the proportions of female suicide victim.pdfWe are interested in whether the proportions of female suicide victim.pdf
We are interested in whether the proportions of female suicide victim.pdf
 
True or false Fruits attract animals that act as pollinators T.pdf
True or false Fruits attract animals that act as pollinators T.pdfTrue or false Fruits attract animals that act as pollinators T.pdf
True or false Fruits attract animals that act as pollinators T.pdf
 
the observed locations of integrated retroviral proviruses within ho.pdf
the observed locations of integrated retroviral proviruses within ho.pdfthe observed locations of integrated retroviral proviruses within ho.pdf
the observed locations of integrated retroviral proviruses within ho.pdf
 
The general name for something that binds to a protein is Select one.pdf
The general name for something that binds to a protein is  Select one.pdfThe general name for something that binds to a protein is  Select one.pdf
The general name for something that binds to a protein is Select one.pdf
 
serial communication, parallel communication, SPI and ADCs. Write .pdf
serial communication, parallel communication, SPI and ADCs. Write .pdfserial communication, parallel communication, SPI and ADCs. Write .pdf
serial communication, parallel communication, SPI and ADCs. Write .pdf
 
The first part of the assignment involves creating very basic GUI co.pdf
The first part of the assignment involves creating very basic GUI co.pdfThe first part of the assignment involves creating very basic GUI co.pdf
The first part of the assignment involves creating very basic GUI co.pdf
 
Oxfam used its existing opt-in e-mail list only for this campaign; i.pdf
Oxfam used its existing opt-in e-mail list only for this campaign; i.pdfOxfam used its existing opt-in e-mail list only for this campaign; i.pdf
Oxfam used its existing opt-in e-mail list only for this campaign; i.pdf
 
Please distinguish between the .h and .cpp file, create a fully work.pdf
Please distinguish between the .h and .cpp file, create a fully work.pdfPlease distinguish between the .h and .cpp file, create a fully work.pdf
Please distinguish between the .h and .cpp file, create a fully work.pdf
 
JUST DO QUESTION 4 1. When you are preparing a budget where could yo.pdf
JUST DO QUESTION 4 1. When you are preparing a budget where could yo.pdfJUST DO QUESTION 4 1. When you are preparing a budget where could yo.pdf
JUST DO QUESTION 4 1. When you are preparing a budget where could yo.pdf
 
In the paramyxoviruses, cleavage of the F0 protein into two subunits .pdf
In the paramyxoviruses, cleavage of the F0 protein into two subunits .pdfIn the paramyxoviruses, cleavage of the F0 protein into two subunits .pdf
In the paramyxoviruses, cleavage of the F0 protein into two subunits .pdf
 
Information about dengue fever is provided on the following pages. A.pdf
Information about dengue fever is provided on the following pages. A.pdfInformation about dengue fever is provided on the following pages. A.pdf
Information about dengue fever is provided on the following pages. A.pdf
 
A toothcomb, rhinarium or moist nose, and vertical clinging and leapi.pdf
A toothcomb, rhinarium or moist nose, and vertical clinging and leapi.pdfA toothcomb, rhinarium or moist nose, and vertical clinging and leapi.pdf
A toothcomb, rhinarium or moist nose, and vertical clinging and leapi.pdf
 
If wolves will not cross a highway, what type of isolating mechani.pdf
If wolves will not cross a highway, what type of isolating mechani.pdfIf wolves will not cross a highway, what type of isolating mechani.pdf
If wolves will not cross a highway, what type of isolating mechani.pdf
 
I dont understand numbers 14 and 15, please help.. PROBLEM BAS .pdf
I dont understand numbers 14 and 15, please help.. PROBLEM BAS .pdfI dont understand numbers 14 and 15, please help.. PROBLEM BAS .pdf
I dont understand numbers 14 and 15, please help.. PROBLEM BAS .pdf
 
How many divisors of 2310 have exactly three prime factors A toy pi.pdf
How many divisors of 2310 have exactly three prime factors  A toy pi.pdfHow many divisors of 2310 have exactly three prime factors  A toy pi.pdf
How many divisors of 2310 have exactly three prime factors A toy pi.pdf
 
Graphs A and B depict two ways of determining how molecules (in this .pdf
Graphs A and B depict two ways of determining how molecules (in this .pdfGraphs A and B depict two ways of determining how molecules (in this .pdf
Graphs A and B depict two ways of determining how molecules (in this .pdf
 
Comment upon Charles Greene’s (1975) suggestion that follower perfor.pdf
Comment upon Charles Greene’s (1975) suggestion that follower perfor.pdfComment upon Charles Greene’s (1975) suggestion that follower perfor.pdf
Comment upon Charles Greene’s (1975) suggestion that follower perfor.pdf
 
Describe the five major phases of a product life cycle. Give example.pdf
Describe the five major phases of a product life cycle. Give example.pdfDescribe the five major phases of a product life cycle. Give example.pdf
Describe the five major phases of a product life cycle. Give example.pdf
 
Early primates likely evolved to exploit new niches provided bya.ins.pdf
Early primates likely evolved to exploit new niches provided bya.ins.pdfEarly primates likely evolved to exploit new niches provided bya.ins.pdf
Early primates likely evolved to exploit new niches provided bya.ins.pdf
 
Argue against increased social responsibilitySolutionSocial re.pdf
Argue against increased social responsibilitySolutionSocial re.pdfArgue against increased social responsibilitySolutionSocial re.pdf
Argue against increased social responsibilitySolutionSocial re.pdf
 

Recently uploaded

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

Suppose that a heap stores 210 elements. What is its height (show w.pdf

  • 1. Suppose that a heap stores 210 elements. What is its height? (show work with diagrams) Solution A binary heap is a complete binary tree which satisfies the heap ordering property. The maximum number of nodes at level l of the heap is 2l. Therefore a heap of height h stores at most 20+ 21+:+ 2h= 2h +1 – 1 node. If h= 6, then the heap stores at most 27 – 1 =127 elements, which is not enough .so the heap must be of height 7,since for height 7 a heap can store 28 – 1 =255. The last level of the heap is not full.