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 finding the maximum element in an array of size n?
Think about the number of comparisons you must make.
What does the Towers of Hanoi question require you to do in essence?
Consider the rules around disk size.
What is the time complexity of a simple loop iterating through an array of size n?
Think about how you check each element.
True or False: The Towers of Hanoi requires exponentially increasing moves for additional disks.
Recall the recursive definition of moves.
Propose an original recursive problem where the solution resembles the Towers of Hanoi and discuss its potential time complexity.
Think about the layering involved in organizing the balls.
Analyze the following pseudocode that implements a nested looping structure and determine its time complexity: for i from 1 to n, for j from i to n { operation } What is the time complexity?
Draw out the iterations to better understand how often the inner loop executes.
4 more questions in this section. Enroll free to practise them all.
Enroll free