Implementation of quicksort algorithm