quick sort memory efficient