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

+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

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.5k
- Others 1.5k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,647 questions

56,492 answers

195,439 comments

100,708 users