Practice question · Put in order
Order the first five steps of the design workflow the lesson recommends.
- Analyze time and space complexity
- Pick data structures that make the hot operations fast
- Choose an algorithmic strategy
- Understand the problem: inputs, output, constraints, and edge cases
- Argue correctness
Hints
- Understanding the problem comes before choosing how to solve it.
- You pick data structures to serve a strategy, and you argue correctness before analysing speed.
Show the answer
- Understand the problem: inputs, output, constraints, and edge cases
- Choose an algorithmic strategy
- Pick data structures that make the hot operations fast
- Argue correctness
- Analyze time and space complexity
Why
Understand, choose a strategy, pick supporting data structures, argue correctness, then analyze complexity (and finally test). Jumping to a strategy before understanding the problem is a classic misstep.
Practise Integrated Algorithm Design Practice
The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Integrated Algorithm Design Practice
- A problem is shown to be NP-complete. Why is that useful news rather than merely bad news?
- For 'find the k most frequent words in a huge text', select every design decision the lesson endorses.
- Given a new problem, an experienced programmer often recognises it as a variant of something known - shortest…
- The fastest algorithm for a problem in the abstract is the right choice regardless of the data and…
- Match each data structure to the hot operation it makes fast.