quicksort implementation in c++ and java