E D R S I H C RSS

QuickSort (rev. 1.2)

ID
Password
Join
Try to divide your time evenly to keep others happy.

FrontPage QuickSort

import random 

def qsort(list):
    
    if len(list) <= 1:
        return list

    pivot = random.choice(list)
    list.remove(pivot)
    
    return qsort([it for it in list if it < pivot]) + [pivot] + qsort([it for it in list if it >= pivot])
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2016-06-30 01:38:17
Processing time 0.0834 sec