Tag Archives: sort

(Java) Quicksort in Java, with Enforced Suckitude

It’s no fun implementing QuickSort unless you can force it out of its blister-fast, O(n log n) speed and humiliate it with its worst-case, O(n^2) runtime. So that’s what I set out to do. My naive partition simply pivots around the low item, but my randomized partition defeats the sucky inputs by choosing a random [...]

Posted in Java | Also tagged , , , , , | Leave a comment

(C++) [CISP 430] Heapsort

  The Heapsort algorithm implemented in C++

Posted in C++ | Also tagged , , , , , | Leave a comment

(Haskell) Merge sort

Posted in Haskell | Also tagged , , | Leave a comment

(Haskell) Reverse map

`pam` is some sort of reverse `map` (hence the name). While `map` applies a function to a list of arguments, `pam` applies a list of functions to the same argument.

Posted in Haskell | Also tagged , , , , | Leave a comment