I am trying to implement quicksort.
I do not know how to concatenate the three arrays and printing them.
Could someone please help me complete my code?
def sort(array=[2,5,1,6,9,8,7,10,21,12]):
less = []
equal = []
greater = []
if len(array) > 1:
pivot = array[0]
for x in array:
if x < pivot:
less.append(x)
if x == pivot:
equal.append(x)
if x > pivot:
greater.append(x)
sort(less)
sort(pivot)
sort(greater)