AllRounder.ai
Chapters in this course

Enrol to start learning

Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.

Enrol free

9.4. Insertion and Deletion in Heaps

  • This section

    Practice test

    11 questions on this section. Wrong answers show you what to read again.

    Sign up to take it
  • Whole chapter

    Revision test

    Mixed questions from across the chapter. Your answers get marked.

    Sign up to take it
  • Quick

    Flashcard drill

    4 cards from this lesson. Good the night before a test.

Try these first

  1. 1.

    What is the maximum value of a max-heap?

    Hint

    Look at the root of the tree.

  2. 2.

    Describe how to insert a new value into a heap.

    Hint

    What position do we fill when adding a new node?

  3. 3.

    What property must a max-heap satisfy?

    • A. Every parent node must be less than its children.
    • B. Every parent node must be equal to its children.
    • C. Every parent node must be greater than or equal to its children.
    Hint

    Think about the definition of max-heap.

  4. 4.

    True or False: Insertion in a heap can violate the max-heap property.

    • True
    • False
    Hint

    What happens when we add a value larger than its parent?

  5. 5.

    Given a max-heap of [30, 20, 25], insert 15 and demonstrate the steps required to maintain the heap property.

    Hint

    Where does 15 go, and does it change anything?

  6. 6.

    Starting with the heap [50, 30, 25, 20, 15], delete the root and show the new state of the heap after replacement and sifting down.

    Hint

    Ensure to visualize each change step.

Exercises

Total Questions

2

Estimated Time

4 min

Passing Score

70%

Instructions

  • Read each question carefully
  • You can use hints if you need help
  • Complete all questions before submitting

4 more questions available

Enrol free

Quiz

Total Questions

2

Estimated Time

4 min

Passing Score

70%

Instructions

  • Read each question carefully
  • You can use hints if you need help
  • Complete all questions before submitting

1 more question available

Enrol free

Challenge Problems

Total Questions

2

Estimated Time

4 min

Passing Score

70%

Instructions

  • Read each question carefully
  • You can use hints if you need help
  • Complete all questions before submitting