All Exams Test series for 1 year @ ₹349 only
Question

Which of the following algorithms sort n integers, having the range 0 to \((n^{2}-1)\), in ascending order in \(O(n)\) time ?

This question was previously asked in
UGC NET 2015 Paper 2 History Question Paper (28-Jun-2015)
The correct answer is

Radix sort

Write each value in base n; any number up to \(n^{2}-1\) needs only 2 base-n digits.

Radix sort then makes 2 passes of counting sort, each costing \(O(n + n) = O(n)\), so the total is \(O(n)\).

Selection, bubble and insertion sort are comparison sorts with \(O(n^{2})\) worst-case time.

Hence, Radix sort.

Was this answer helpful?

Similar Questions

  1. Any decision tree that sorts n elements has height

  2. You have to sort a list L, consisting of a sorted list followed by a few ‘random’ elements. Which of the following sorting method would be most suitable for such a task ?

  3. If there are n integers to sort, each integer has d digits and each digit is in the set {1, 2, ..., k}, radix sort can sort the numbers in :

  4. An ideal sort is an in-place-sort whose additional space requirement is __________.

  5. Suppose that the splits at every level of quicksort are in the proportion \((1 - \alpha)\) to \(\alpha\), where \(0 \lt \alpha \le \frac{1}{2}\) is a constant. The minimum depth of a leaf in the recursion tree is approximately given by

  6. Mergesort makes two recursive calls. Which statement is true after these two recursive calls finish, but before the merge step ?

  7. Any decision tree that sorts n elements has height ________.

  8. Select the Sorting Algorithms that are stable.

    (A) Quick Sort

    (B) Bubble Sort

    (C) Insertion Sort

    (D) Merge Sort

    (E) Shell Sort

    Choose the correct answer from the options given below :


Important Questions from Sorting

  1. Consider an array $A = [10, 7, 8, 19, 41, 35, 25, 31]$. Suppose the merge sort algorithm is executed on array $A$ to sort it in increasing order. The merge sort algorithm will carry out a total of 7 merge operations.

    A merge operation on sorted left array $L$ and sorted right array $R$ is said to be void if the output of the merge operation is the elements of array $L$ followed by the elements of array $R$.

    The number of void merge operations among these 7 merge operations is __________. (answer in integer)
  2. What is the worst case time complexity of bubble sort?

  3. The pseudocode of a function fun() is given below:

    fun(int A[0, …, n-1]) {
        for i = 0 to n - 2
            for j = 0 to n - i - 2
                if (A[j] > A[j + 1])
                    then swap A[j] and A[j + 1]
    }
    

    Let 𝐴[0, … ,29] be an array storing 30 distinct integers in descending order. The number of swap operations that will be performed, if the function fun() is called with 𝐴[0, … ,29] as argument, is __________. (Answer in integer)

  4. Any decision tree that sorts n elements has height

  5. You have to sort a list L, consisting of a sorted list followed by a few ‘random’ elements. Which of the following sorting method would be most suitable for such a task ?

Need Expert Advice?
Upcoming Exams
CTET
December 12, 2026
CBSE UGC NET
December 14, 2026
CSIR UGC NET
December 19, 2026
Test Series
UGC NET img
Teaching
UGC NET (Paper 2) 2026 Mock Test Series
796 Tests 2 Tests Free
219 Attempts
4.4(46)
English
More Questions from UGC NET

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App