core Estimated learning time: 12 h

P-7.6 Timed Practice: Recursion, Sorting and First Dynamic Programming

You can turn a recursion into a table when the same subproblem repeats, and you know which sorting facts a round actually asks for.

The third area, and the one where the honest depth statement matters most. A services screening asks whether you can recognise a repeated subproblem and remember an answer instead of recomputing it, and which sort is stable; a product interview asks you to design the table order and argue the cost. Both sit on the recursion, sorting and dynamic programming topics in the algorithms module, and neither is repeated here. This is the same material worked against a clock, with the introductory half named as introductory rather than dressed up as the whole subject.

Work through these

  • Write a recursion, notice the repeated call, and remember its answers

    Remembering answers to calls you have already made is the whole of the first step, and it usually turns exponential work into linear work with three added lines. Recognising the repeat is the part that needs practice.

    MIT OpenCourseWare 6.006: Introduction to Algorithms · Course
  • Rewrite the same solution as a table filled in an order that never looks forward

    The table version is what an interviewer usually asks for next, and the difficulty is the order rather than the arithmetic. Writing the order down before filling anything in is the working method.

    Algorithms · Reference
  • Know which sorts are stable and which are in place, and when either matters

    Stability decides whether sorting by one field then another gives the result you wanted. It is a favourite short question because it separates people who have used sorting from people who have only read about it.

  • Search over an answer, not over an array, on one question that hides it

    When a question asks for the smallest value that works, the answers themselves are the sorted range to search. It is the reframing that turns several hard-looking questions into ten lines.

    MIT OpenCourseWare 6.006: Introduction to Algorithms · Course
  • Work one full timed set mixing all three areas, and write the honest weak list at the end

    Mixed sets are harder than single-area sets because recognising the shape is part of the work. The weak list at the end is what makes the next session worth sitting.

Sign in to keep your progress.

Free resources

Links last checked 31 Aug 2026.

Stuck here?

Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.

Checking your session…

Topics shown in module order.