Implementation of quick sort algorithm