* This function partitions a in three parts a ) a [ l . . i ] contains all elements * smaller than pivot b ) a [ i + 1. . j - 1 ] contains all occurrences of pivot c ) * a [ j . . r ] contains all elements greater than pivot
function partition ( a , l , r ) { i = l - 1 ; j = r ; var p = l - 1 , q = r ; var v = a [ r ] ; while ( true ) {