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.
What is the time complexity of finding the maximum element in an array?
Consider how many times we check each number in the array.
How many comparisons are made in a nested loop of size n?
Think about how each element compares with every other element.
What is the time complexity of the Towers of Hanoi with n disks?
Think about how many moves are necessary as disks increase.
True or False: The time complexity of multiplying two n x n matrices is O(n²).
Consider how many rows and columns you need to multiply.
Devise a new algorithm to determine if an array contains duplicates that improves on O(n²). Discuss your approach and explain the new time complexity.
Think about a data structure that allows fast lookups.
Analyze how the time complexity of binary search differs from linear search. Explain a scenario where binary search is significantly more efficient.
Consider searching through a sorted phonebook versus flipping through pages.
5 more questions in this section. Enroll free to practise them all.
Enroll free