DMPG '17 B4 - Bad Sort
View as PDFRoger is teaching his CS club how to sort! This algorithm looks like this:
function sort(A[0 .. N - 1]):
    if A is not empty:
        pivot <- A[N/2]
        lesser <- []
        equal <- []
        greater <- []
        for each a in A:
            if a < pivot:
                append a to lesser
            if a = pivot:
                append a to equal
            if a > pivot:
                append a to greater
        sort(lesser)
        sort(greater)
        A <- lesser + equal + greater
However, you think that Roger is inferior to , and that his sort has a devastating flaw! Can you generate a worst case?
Input Specification
There is no input.
Output Specification
Print  integers, each on a newline, representing a worst-case scenario for the sorting algorithm.
Comments
This is funny because Roger is Kirito