Question

2 marks] Consider the heap structure below, what does the heap look like after removing the top element from it using the method presented in lectures? 3 19 32 21 15 19 32 2115 15 19 21 22 32

someone EXPLAIN this please( python )

0 0
Add a comment Improve this question Transcribed image text
Answer #1

For this problem we need to do few steps: -

1. Heap property should be followed

2. First step is to remove the top element and replace it with last element

so 3 is replaced with 15.Now as 8 is less than 15, Heap property is not maintained so we replace it.So top element becomes 8 and child of 8 becomes 15 and child of 15 becomes 21.

So d) is the answer

Add a comment
Know the answer?
Add Answer to:
someone EXPLAIN this please( python ) 2 marks] Consider the heap structure below, what does the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • explain in words please Consider an object moving with a constant positive acceleration. What does a...

    explain in words please Consider an object moving with a constant positive acceleration. What does a graph of its velocity as a function of time look like? What does a graph of its position as a function of time look like?

  • 9. Consider the code below. At the location indicated by “RIGHT HERE”, what does the stack...

    9. Consider the code below. At the location indicated by “RIGHT HERE”, what does the stack currently look like? Please draw a picture. Where will ESP and EBP currently be pointing? Add these pointers to your picture. main: push 13 push 17 call func_a add esp, 8 ret func_a: push ebp mov ebp, esp sub esp, 12 mov DWORD [ebp – 4], 19 mov DWORD [ebp – 8], 23 ; <-- RIGHT HERE. Draw a picture ; What does the...

  • Please Write Pseudocode or Python code! Thanks! P1. b) is the following: W1. (6 marks) Write...

    Please Write Pseudocode or Python code! Thanks! P1. b) is the following: W1. (6 marks) Write the pseudocode for removing and returning only the second element from the Stack. The top element of the Stack will remain the top element after this operation. You may assume that the Stack contains at least two items before this operation. (a) Write the algorithm as a provider implementing a Stack using a contiguous memory implementation. You can refer to the implementation given in...

  • I need all please 19. Consider the molecule SiCl4. The electronegativity values for Si and Cl...

    I need all please 19. Consider the molecule SiCl4. The electronegativity values for Si and Cl are 1.8 and 3.0, respectively. Based on these values and on consideration of molecular geometry: a. Determine if the Si-Cl bond is polar or nonpolar b. Determine if the SiCl4 molecule is polar or nonpolar. Explain why you chose your answers. 20. Draw the Lewis structure for Chlorine 21. Name an element that is likely to form an ion with a +1 charge and...

  • Write a Java program, In this project, you are going to build a max-heap using array...

    Write a Java program, In this project, you are going to build a max-heap using array representation. In particular, your program should: • Implement two methods of building a max-heap. o Using sequential insertions (its time complexity: ?(?????), by successively applying the regular add method). o Using the optimal method (its time complexity: ?(?), the “smart” way we learned in class). For both methods, your implementations need to keep track of how many swaps (swapping parent and child) are required...

  • PYTHON 3 PLEASE FOLLOW INSTRUCTIONS #COMMENT STEPS :) Problem Given a triangle of integers, we want...

    PYTHON 3 PLEASE FOLLOW INSTRUCTIONS #COMMENT STEPS :) Problem Given a triangle of integers, we want to find the path that has the largest sum going from the top to the bottom of the triangle. The way we go down the triangle is by moving down level by level, at each level having the choice to either go straight down to the integer directly below, or the integer below and to the right. Consider the following triangle: 10 25 13...

  • Please explain answer :D Question 5 (5 marks] Consider the syntactically correct C code below, which...

    Please explain answer :D Question 5 (5 marks] Consider the syntactically correct C code below, which is missing a function print_diagonal include <stdio.h> • typedef int Table(100) (100); */• print diagonal (T, n) . Given a Table T, which will have n rows and n columns, print all of the 1 entries on the main diagonal of T (that is, entries whose row number and column number are equal). Remember to print a newline at the end. / ► /...

  • Questions 1. How to create a comment in python? 2. The way to obtain user input...

    Questions 1. How to create a comment in python? 2. The way to obtain user input from command line 3. List standard mathematical operators in python and explain them 4. List comparison operators in python 5. Explain while loop. Give example 6. Explain for loop. Give example 7. How to create infinite loop? And how to stop it? 8. Explain a built-in function ‘range’ for ‘for’ loop 9. Explain break statement 10. Explain continue statement 11. Explain pass statement 12....

  • Please Explain, Thanks :) QUESTION 2 Ghen is a java class าน¡strate, what are the contents...

    Please Explain, Thanks :) QUESTION 2 Ghen is a java class าน¡strate, what are the contents of the object right after line 13 in the main method ? public class Illustrate public ธtatic void main (String[] args) int xj private statie int y o public statie int count 0; public 1llustrate() 1. Illustrate I1 2. Illustrate 12 new Illustrate(3); new Illustrate(5): 4. Illustrate.incrementY) public Illustrate(int a) 9. Illustrate.count 10 public Illustrate(Illustrate 1) this.x I.x public vold setx(inta) 12. 13. Illustrate...

  • can someone please help me with this Question 2 (10 marks) From the following details provided...

    can someone please help me with this Question 2 (10 marks) From the following details provided by Mark Ltd, prepare (0) a detailed multi-step Income Statement for the year ended 30 June 2018 () a classified Balance sheet as at 30 June 2018 (4 marks) (6 marks) 262,000 Sales revenue Accounts receivable 238,000 A Cost of Sales Lnventory Salary expense Prepaid rent -Rent expense 512,000 68, 000 Goodwil 90,000 Annual depreciation on Building Building Advertisins expense Accumulated depredlation on Building...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT