implemeted median-of-threes optimization with unrolled bubblesort