Data Structures u0026 Algorithms: Sorting Algorithms Quiz

Test your advanced understanding of core sorting algorithms, their complexities, and underlying data structures with these thoughtfully designed questions.

  1. Bubble Sort Pass Count

    Given an array of 6 integers in reverse order, how many total passes (outer loop iterations) are required in the worst-case scenario for Bubble Sort to guarantee the array is sorted?

    1. 4
    2. 6
    3. 7
    4. 5
    5. 3
  2. Selection Sort Operation Count

    If you run Selection Sort on an array of n elements, how many times in total will the swap operation be executed in the worst-case scenario?

    1. n^2
    2. n/2
    3. log n
    4. 2n
    5. n-1
  3. Insertion Sort and Partially Sorted Data

    Given a nearly sorted array where each element is at most k positions away from its final sorted location, what is the best-case time complexity for Insertion Sort?

    1. O(nk)
    2. O(n)
    3. O(n log k)
    4. O(k^2)
    5. O(n^2)
  4. Merge Sort Space Complexity

    What is the minimum additional space complexity (not total, just auxiliary) required by the standard Merge Sort algorithm when sorting an array of n elements?

    1. O(n)
    2. O(log n)
    3. O(1)
    4. O(n log n)
    5. O(2n)
  5. Quick Sort Partition Logic

    In the standard Lomuto Quick Sort partition algorithm, what happens if all elements are equal to the pivot in a subarray?

    1. Partitioning divides the array into two empty halves
    2. All elements are moved to the left of the pivot
    3. Partitioning fails and terminates the sort
    4. All elements are moved to the right of the pivot
    5. The pivot is placed at the last position tested
  6. Heap Sort Root Swap Frequency

    In Heap Sort, how many times is the root element swapped with the last element within the main loop for an array of n elements?

    1. n/2 times
    2. n-1 times
    3. 2n times
    4. log n times
    5. n times
  7. Counting Sort and Value Range

    Given an array of n positive integers where the maximum value is k, what is the space complexity of Counting Sort in terms of n and k?

    1. O(n+k)
    2. O(n^2)
    3. O(n)
    4. O(k)
    5. O(n log k)
  8. Stable Sorting Algorithm Identification

    Which of the following listed sorting algorithms is inherently stable in its standard implementation?

    1. Shell Sort
    2. Selection Sort
    3. Heap Sort
    4. Quick Sort
    5. Counting Sort
  9. Non-Comparison Based Sorting

    Which sorting algorithm from the following relies on the actual values of the elements rather than their pairwise comparisons to sort an array of integers?

    1. Bubble Sort
    2. Insertion Sort
    3. Counting Sort
    4. Merge Sort
    5. Quick Sort
  10. Best Case Time Complexity Match

    For which of the following sorting algorithms does the best-case time complexity match the worst-case time complexity for all input data?

    1. Selection Sort
    2. Quick Sort
    3. Bubble Sort
    4. Merge Sort
    5. Insertion Sort