Yes, quick sort is in place algorithm . . . As quick sort doesn't require new space it does the sorting in that array it self . . . Where as merge sort is not as it takes extra spaces for all the sub problems

The Gateway to Computer Science Excellence

+1 vote

+2 votes

Yes quicksort is an inplace algorithm as it does not require auxiliary array for sorting purpose like in the case of mergesort..

+1

Stack space is also taken by mergesort..That has to be taken for function calls ..So we are not considering that..We are only considering auxilliary space required for data..

0

I think it will be depend upon question...

We have to write O(logn) in gneral case...

But with comparison to other algo's like merge sort..as habib said we will consider O(1)

We have to write O(logn) in gneral case...

But with comparison to other algo's like merge sort..as habib said we will consider O(1)

0

It all depends on the definition of "in-place" algorithm. If you define "in-place" as requiring a constant amount of memory, then quicksort is not "in-place" as it requires log(N) memory for the recursion. If you define "in-place" as more human-friendly "does not move the data outside the input structure", then quicksort is again not "in-place". |

http://stackoverflow.com/questions/22028117/is-quicksort-in-place-or-not

52,345 questions

60,489 answers

201,830 comments

95,297 users