Wun Code
JavaScript

Practical Algorithms

Write functions for searching, sorting, grouping and flattening nested lists once, then reuse them in every project after that.

Start the trackFree, no sign-up needed

What you'll learn

  • Removing duplicatesA one-line Set solution, then the harder case
  • Counting occurrencesHow many times each value appears
  • Splitting into chunksA thousand items in batches of a hundred
  • Binary searchFrom a thousand comparisons down to ten
  • Flattening nested listsTurn a tree into a list
  • PalindromesText that reads the same both ways
  • Sorting by two keysScore first, then name
  • Intersection and differenceFrom n×m down to n+m

Track contents

8 lessons, 1.5 hours in total
  1. 1Removing duplicatesJavaScriptA one-line Set solution, then the harder case
  2. 2Counting occurrencesJavaScriptHow many times each value appears
  3. 3Splitting into chunksJavaScriptA thousand items in batches of a hundred
  4. 4Binary searchJavaScriptFrom a thousand comparisons down to ten
  5. 5Flattening nested listsJavaScriptTurn a tree into a list
  6. 6PalindromesJavaScriptText that reads the same both ways
  7. 7Sorting by two keysJavaScriptScore first, then name
  8. 8Intersection and differenceJavaScriptFrom n×m down to n+m