Subjects ยท Computer Science & Data

Computer Science & Data: Interleaved practice

Choose the right structure or algorithm for a problem, which is the skill, and which chapter-organised practice removes by construction.

What you'll be able to do: Choose the right structure or algorithm for a problem, which is the skill, and which chapter-organised practice removes by construction.

What the chapter takes away

You work through the chapter on hash maps. Twenty problems, all solved with a hash map. By problem eight it's automatic.

Then a real problem arrives with no chapter attached, and the question isn't how do I use a hash map: it's is this a hash map problem?

In a blocked set you never once had to decide. The heading decided for you, twenty times. You practised implementation and the work requires selection, and nothing in the chapter touched it.

This matters more in computing than in most subjects because the selection space is unusually large and the consequences are unusually specific. Array, list, set, dict, heap, tree, graph, queue, most problems can be solved badly with most of them, so the wrong choice produces working code that's wrong in ways only visible at scale.

The interleaving sets worth building

Data structures. Mix problems where the answer is a dict, a set, a heap, a deque and a plain list. The tell for each is a specific phrase in the requirement: "fast lookup by key", "no duplicates", "always want the smallest", "add and remove at both ends", and recognising those phrases is the skill.

Algorithms. Mix problems needing sorting, binary search, BFS, DFS, dynamic programming and greedy. Most competitive-programming difficulty is recognising which family a problem is in.

SQL. Mix problems needing joins, subqueries, window functions, aggregation and CTEs. Chapters teach these separately and real queries need you to pick.

Complexity. Mix problems where the bottleneck is time, space, I/O and network. Students trained on time complexity alone miss the other three entirely.

ML. Mix problems needing classification, regression, clustering, dimensionality reduction, and crucially, problems that don't need ML at all, That last category is absent from every course and common in practice.

Debugging. Mix bug types, logic, state, concurrency, environment, data. The debugging procedure differs by type and recognising the type early is most of the speed difference between novices and experts.

Testing. Mix unit, integration, property and regression scenarios, and ask which is appropriate here.

How to run it

Give me 12 problems mixed randomly from [topics]. Don't label which type each is. Before each, I'll tell you which data structure or algorithm I'll use and WHY, correct my selection before I implement, and tell me what in the problem statement should have signalled the right choice. At the end, separate my errors into selection errors and implementation errors.

That last separation is the output that matters. "Wrong" splits into I chose the wrong tool (which needs discrimination practice) and I chose right and implemented it badly: which needs something entirely different.

And the phrase-recognition request is specific to this subject: ask what in the wording should have signalled the choice. Over a dozen problems you build a mapping from requirement-language to structure that no chapter teaches explicitly.

Expect it to feel worse

Interleaved practice produces lower performance during practice and better performance later, and learners reliably rate it as less effective while doing better from it. Your accuracy will drop relative to blocked practice. That's the method working.

When not to

  • Not while learning a structure for the first time. You need enough competence with each individually to have something to choose between.
  • Not when drilling an implementation for speed: a technical interview where you need a specific algorithm fluent, for instance.

Block to acquire, interleave to discriminate.

The realistic version

The most useful interleaving in this subject isn't exercises, it's problems stated as requirements, in plain language, with no hint of the solution approach. That's what a ticket looks like, and the translation from requirement to structure is the professional skill.

Give me six problems stated as plain-English requirements, the way a colleague would describe them. No hints about approach. I'll say what I'd use and why.

Pitfalls

  1. Labelling the problems. Keeps the discomfort, removes the benefit.
  2. Two types only. Alternation is a detectable pattern.
  3. Quitting because accuracy dropped. Expected. Judge it in a week.
  4. Not stating the choice first. Without the conscious selection it's a shuffled problem set.
  5. Skipping the "what should have signalled it" question. That mapping is the transferable part.
  6. The tell: you can pick the right structure when told the chapter and can't when given a requirement.

Try this today

Take three data structures you've studied separately. Ask for twelve mixed, unlabelled problems stated as requirements.

Before each, say what you'd use and why, before writing anything. Then ask what in the wording should have told you.

That mapping is the thing chapters never give you.