Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is the time complexity of inserting an element into a heap?
Think about how many levels the tree has.
Explain what a min heap is.
Consider the size relationship between parents and children.
What does a min heap do?
Think of how hierarchy is maintained in a tree.
Is Dijkstra's algorithm efficient for finding the shortest path in unweighted graphs?
Consider when each vertex is equally accessible.
Implement a function that builds a min heap from a given array and demonstrate extraction of the minimum element.
Remember to percolate the elements down correctly after extraction.
Design an example graph and apply Dijkstra's algorithm step by step, illustrating the heap updates and distance calculations.
Track the distances and the vertices as you proceed!
4 more questions in this section. Enroll free to practise them all.
Enroll free