Search the courses, subjects, tracks, games and features, or jump straight to a page.
5 cards from this section. Quick, good the night before a test.
Describe the main difference between max heaps and min heaps.
Think about the relationship between parent and child nodes.
What time complexity does inserting an element in a heap have?
Consider the height of the heap and how far you might need to move elements.
In a max heap, which of the following statements is true?
Think about the structure of the heap.
True or False: In a min heap, the children of a node can exceed the parent value.
Consider the definition of a min heap.
Construct a max heap from the following array: [3, 9, 2, 15, 5, 11]. Illustrate the process.
Begin at the first non-leaf node, observe each parent-child relationship.
Given a binary tree, how do you convert it to a min heap while preserving the tree's structure? Provide a step-by-step algorithm.
Think about how to organize the values layer by layer similar to level order traversal.
6 more questions in this section. Enroll free to practise them all.
Enroll free