Intermediate

Data Structures and Algorithms in Java

Enough to pass an interview, and enough to pick the right collection.

Complexity you can measure rather than memorise, the structures behind the collections you already use, and the algorithms worth recognising — taught against java.util rather than against pseudocode.

11 lessons written3 modules~2h reading

After this course you can

  • Say what happens to your code when n gets a thousand times bigger, and why you cannot see it in development
  • Choose between ArrayList, LinkedList, HashMap, TreeMap, ArrayDeque and PriorityQueue for a stated reason
  • Recognise the handful of algorithm shapes that cover most interview questions

Curriculum

11 lessons · outlined lessons show their plan
01

Complexity

2/2 written · ~23 min
Big-O, measuredn went up 100 times; a List took 1,150 times longer and a HashSet 9. Why the wrong structure is invisible at the size you test with.12 minSpace complexityFive million ints is 18.9 MB and five million Integers is 95.4. Auxiliary space, the call stack that counts, and the trades you make on purpose.11 min
02

The structures behind the collections

3/3 written · ~33 min
Which structure, which collectionEvery structure in an algorithms course is in java.util under another name. The map, and the two rows people get wrong.11 minTriesThe one structure with no java.util equivalent, for the question a hash table cannot answer: what starts with this?10 minGraphsJava has no graph type. A hundred thousand vertices cost 19 MB as a list and 1,192 MB as a matrix, and that is the first decision.12 min
03

Algorithms worth recognising

6/6 written · ~69 min
Sorting and searchingWhat Java's sorts actually are, why TimSort exists, and binary search on the thing you forgot to sort.12 minTwo pointers and sliding windowThe two patterns that turn a nested loop into one pass.11 minRecursion and backtrackingBase cases, the stack you are spending, and the search that undoes its own moves.12 minBreadth-first and depth-firstTwo ways to walk a graph, and how the choice decides what you find first.11 minGreedy and dynamic programmingWhen taking the best step works, when it does not, and memoisation as the fix.13 minUnion-findDisjoint sets, path compression, and the problems it makes trivial.10 min