Which of the following sorting algorithms does not use recursion?

2024

Which of the following sorting algorithms does not use recursion?

Answer: D. Bottom-up merge sortConcept: A sorting algorithm is recursion-free when its standard, defining process is an iterative pass structure -- repeatedly looping over the data --…

  1. A.

    Quick sort

  2. B.

    Merge sort

  3. C.

    Heap sort

  4. D.

    Bottom-up merge sort

Attempted by 124 students.

Show answer & explanation

Correct answer: D

Concept: A sorting algorithm is recursion-free when its standard, defining process is an iterative pass structure -- repeatedly looping over the data -- rather than a function that calls itself on a smaller version of the same problem. Divide-and-conquer algorithms such as quick sort and the classic (top-down) merge sort are defined by recursively splitting the problem before combining results; heap sort's array-based heap operations are also conventionally coded with a recursive sift-down/heapify step in most standard treatments, even though an iterative version is possible. Bottom-up merge sort, by contrast, is defined precisely as the iterative alternative to these recursive designs -- it has no recursive step at all.

Application: Bottom-up merge sort sorts an array of n elements purely iteratively, without any recursive call:

  1. Treat every single element as a sorted subarray of size 1.

  2. Pass 1: merge adjacent subarrays of size 1 into sorted subarrays of size 2, scanning left to right.

  3. Pass 2: merge adjacent subarrays of size 2 into sorted subarrays of size 4.

  4. Continue doubling the subarray size on each pass (8, 16, and so on) until one pass produces a single sorted subarray covering the whole array.

Each pass is a simple loop over the array — there is no function calling itself on a smaller instance of the same array, so bottom-up merge sort is the algorithm that does not use recursion.

Contrast: The other three options are all normally implemented with recursion:

  • Quick sort partitions the array around a pivot, then calls itself on the left and right partitions.

  • The standard (top-down) merge sort recursively splits the array in half until single elements remain, then merges on the way back up the call stack.

  • Heap sort's core heapify step is conventionally written as a function that calls itself to sift a node down the heap in most standard treatments (an iterative version is possible, but that is a secondary implementation choice, not what characterizes the algorithm).

Cross-check: The top-down algorithms all need a call stack whose depth grows with the number of splits (about log n), while bottom-up merge sort's loop-based passes need no call stack at all — confirming bottom-up merge sort as the non-recursive method among the four.

Explore the full course: Accenture Preparation

Loading lesson…