Here is simple quick sort function written in Python to sort a list of numbers.
# return the list if only one is left
if len(toSort) < = 1:
# set the value to pivot around
pivot = toSort # initialize lists
less = 
greater = 
# sort the list
# skip the first value
for item in toSort[1:]:
if item < = pivot:
# recurse on both lists
r = qsort(less)
x = [1,99,7,0,7,7,7,99999,8,9,14,74,88]
This example is not very useful since python lists have a built in sort function, but should you have a list of tuples that you wanted to sort this function could very easily be modified to work with a value within the tuple that it pulls out instead of sorting by just the item itself.