Hacker News new | ask | show | jobs
by vunderba 133 days ago
The collapse sort "algorithm".

  A = [2, 7, 1, 8, 28, 18]
  sort = A => A.reduce((B, x) => (B[x] = x, B), []).filter(x => x)
Nothing says efficiency like a sorting algorithm where Big O is more influenced by the largest element's value rather than the number of elements in the array. /s