Ineffective Sorts
Ineffective Sorts
Ineffective sorts

The comic gives examples of four non-functional sorting algorithms written in pseudo - Python .
The first sort is an unfinished merge sort . The merge sort works recursively by dividing a list in half and performing a merge sort to each half. After the two halves are sorted, they are merged, taking advantage of the fact that the two halves are now in correct order and thus the merge can be done efficiently. The author of the merge sort in the comic appears to have given up on writing the sorted-merge part of the sort, which is why it's a half-hearted merge sort, but instead concatenates the halves without sorting. In its current state, the sort would divide the list into elements of size one, then recombine them in their original unsorted order, but in nested lists - making the original data more difficult to work with. The author acknowledges this failing with the comment "Ummmmm... Here. Sorry."
The second sort is an "optimized" variant of bogosort . A standard bogosort works by randomly shuffling the elements in the list until they are sorted. In a comment, the author points out that this variant of bogosort runs in O(n log(n)), whereas standard bogosorts actually have an expected runtime of O(n·n!) but may never finish. This variant of bogosort finishes so much faster because in most cases it does not actually sort the list, instead reporting a fictitious error in the operating system (a "kernel page fault") if the list isn't ordered after shuffling log(n) times.  The bogosort is "optimized" because no comparison sort algorithm can possibly do better than O(n log(n)) in the worst case.
The third sort parodies a programmer explaining a quicksort during a job interview. The quicksort works by choosing an index as a pivot value and sorting all elements less than the pivot before the pivot and all the elements greater than the pivot after the pivot. It then does a quicksort to the section less than the pivot and the section greater than the pivot until the whole list is sorted. The interviewee flounders for a little while, then asks whether they can use the standard libraries to call a quicksort. The joke being, the standard library contains a quicksort, and the programmer would rather rely on that (possibly even pass it off as his own work) than his own example of quicksort. While it's commonly a good idea in real projects, this would surely count as a failure on interview.
The final sort is just a mess. First it checks to see if the list is sorted, and exits if it is. Then it rotates the list by a random amount 10,000 times (as if cutting a deck of cards) and exits if the list is ever sorted. Next, in desperation, it checks if the list is sorted three times. Finally, realizing that they have no chance of success, the author performs the computer equivalent of a Rage Quit and attempts to destroy the computer rather than admit defeat. First, the program attempts to schedule a shutdown of the computer in five seconds, then attempts to delete the current directory, then attempts to delete the user's home directory (presumably the grader's files), and finally all the files on the computer. rm is a POSIX command; the -r and -f flags mean that the remove command will remove all contents of the specified directories and will not prompt the user beforehand. Under the guise of " portability ", the program runs the equivalent Windows rd command with switches to delete all files from the "C:" drive without prompting. Finally, the program returns a list containing the numbers one through five in order.
In the title text, StackOverflow ( link ) is a question-and-answer site where programmers can ask and answer questions on programming. The author of this code takes advantage of the hopes that someone on StackOverflow knows what they are doing and has posted code to sort a list... and somebody implemented stacksort ; well, sort of.
Ineffective sorts
