Final version of quick sort with pthreads