Implemented quick sort algorithm