Searching, Sorting & Recursion¶
This block teaches how to find data fast, organize it cleanly, and solve problems by breaking them into smaller pieces. You'll master searching, sorting (bubble through quicksort), and recursion with real speed comparisons.
Master these to write faster code and understand why Java's built-in methods work so well.
What this block is for
Searching finds data, sorting organizes it, recursion breaks big problems into small ones. These skills power Google search, Amazon listings, Netflix recommendations, and more. Simple choices (O(n) vs O(log n) vs O(n log n)) make huge speed differences with big data.
What you should get from this block¶
- Choose linear search (simple, unsorted) vs binary search (fast, sorted).
- Write and trace bubble, selection, insertion, merge, and quicksort by hand.
- Understand recursion: when to stop (base case) and how calls stack up.
- Read speed tables (O(n), O(n²), O(n log n)) and pick the right one for your data.
- Use Java's
Arrays.sort()andCollections.sort()like a pro.
How to study (simple routine)
Slides → draw tiny examples (6-8 items) → code → test vs built-ins. Always ask: "Is data sorted? How big is it? What's my stopping condition?"
Key topics¶
"Searching finds what matters. Sorting puts it in order. Recursion breaks the impossible into simple steps."
