Stage 4

Stage 4: DSA in Kotlin

✅ Complete. Every part below has its full lesson (README.md), examples/, exercises.md and solutions/, and every program was compiled and run on the toolchain recorded in ../TOOLING.md (kotlinc 2.4.21, JDK 21) — see each part's README for real, captured output.

Goal: Translate the classic data-structures-and-algorithms curriculum into Kotlin, using Kotlin's own standard-library types (ArrayDeque, PriorityQueue via java.util, MutableList) instead of reimplementing everything from scratch. Time: about 4 weeks, ~1 hour a day of theory/examples plus daily practice problems · Level: finished Stage 1 at minimum; Stage 2's collections and OOP help but aren't required.


Prerequisites

Part in this stage

Part Topic Learning outcomes (in order) Real-world example
17 Data structures and algorithms in Kotlin Big-O notation → hashing (HashMap/HashSet internals, in brief) → two pointers/sliding window → stack/queue via ArrayDeque → recursion and backtracking → sorting (built-in sortedBy/sortWith plus writing one sort by hand) → binary search (binarySearch, writing your own) → singly linked list (built by hand — Kotlin has no built-in one) → trees (binary tree, BST) → heaps via java.util.PriorityQueue → graphs and BFS/DFS → dynamic programming (memoization, then tabulation) Undo button (stack), trending items (heap), delivery route (graph)

This mirrors the single-part, many-topics shape of the sibling Python course's DSA stage: one big part, worked through topic by topic, with daily problem-solving alongside it rather than "exercises" at the end.

How the part will be organised (once content lands)

part-17-dsa-in-kotlin/
├── README.md      ← 1. read the lesson (topic by topic, in order)
├── examples/      ← 2. run the example programs with kotlinc
├── exercises.md   ← 3. solve the practice questions yourself
└── solutions/     ← 4. only then compare with the solution

How the code will run

Same pattern as Stage 1 — plain .kt files, no Gradle, no third-party library:

kotlinc examples/04_stack_queue_deque.kt -include-runtime -d stack_queue_deque.jar
java -jar stack_queue_deque.jar

Open item for the content wave

PriorityQueue and some other structures used here come from java.util, not Kotlin's own standard library — call that out explicitly in the lesson rather than implying Kotlin ships a native heap type. Verify each such Java-standard-library borrow against the installed JDK (see ../TOOLING.md) before publishing.


Practice rhythm

Practice: 2–3 problems a day (easy → medium), written and actually run in Kotlin — not pseudocode. Any site's problems work; the point is the muscle of translating an algorithm idea into real, compiling Kotlin.


Stage 4 checklist (once content lands)

Next: 🚀 Stage 5: Specialization

Search the guide