Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is the time complexity for inserting an element into a heap?
Think about the height of the tree.
What is a min-heap?
Consider how it relates to priority.
What is the primary purpose of a heap data structure?
Consider what ‘priority’ means.
True or False: In a min-heap, the root node is always the largest.
Reflect on the nature of min vs max.
Given a scenario where elements are inserted into a min-heap, describe how to construct the heap step by step. Start with the array [5, 3, 8, 4, 1]. Illustrate each insertion and the resultant heap after each step.
Think about how parents and children relate in value when inserting.
Imagine you have a min-heap structured as [2, 3, 5, 7, 9] and you want to decrease the value of 5 to 1. Explain the steps required to maintain the integrity of the heap structure after this operation.
What happens first when you change a value?
6 more questions in this section. Enroll free to practise them all.
Enroll free