MockTestKartEnglish
Questions › Reasoning & General Intelligence › Classification / Odd One Out
Question

Which sorting algorithm is not in-place in its standard form?

A.Bubble sort
B.Insertion sort
C.Selection sort
D.Merge sort
Correct Answer: D. Merge sort
Subject: Reasoning & General IntelligenceTopic: Classification / Odd One OutDifficulty: Easy
Detailed textbook explanation

Step-by-step solution

An in-place algorithm sorts using only a constant amount of extra memory, O(1), rearranging elements within the given array. Bubble sort, insertion sort and selection sort all swap elements within the original array and need only a few temporary variables, so they are in-place. Standard merge sort splits the array and merges sorted halves into a separate temporary array of size proportional to the input, requiring O(n) extra space; hence it is not in-place in its standard form.

Key takeaway

Merge sort's merge step needs an auxiliary array of size O(n), so standard merge sort is out-of-place.

Common mistake

Assuming merge sort is in-place because it is a comparison sort — extra memory use, not the comparison method, decides in-place status.

More Questions Like This