Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What is the height of a tree with 7 nodes?
Think about how many levels exist in a perfectly balanced tree.
Where would the child nodes be for the node at index 1?
Use the formulas `2i + 1` and `2i + 2`.
What is the time complexity for insertion in a heap?
Consider the height of the tree as it grows.
In a max heap, which holds true?
Visualize a binary tree where the root is the greatest value.
Given an initial max heap with the values [25, 20, 10, 5, 15], after inserting 30, what will the new heap look like?
Remember to bubble up the new value to maintain heap properties.
Explain how you would convert a given unsorted array into a min heap using the bottom-up heapification method.
Start from the lower levels of the tree, as leaves will already be in min heap order.
6 more questions in this section. Enroll free to practise them all.
Enroll free