Efficiency Showdown: Search Algorithms Comparison Quiz Quiz

  1. Comparing Basic Time Complexity

    What is the average-case time complexity of Binary Search on a sorted array?

    1. O(log n)
    2. O(n^2)
    3. O(n log n)
    4. O(n)
    5. O(1og n)
  2. When to Use Linear Search

    Which situation BEST justifies using Linear Search over Binary Search?

    1. The list is unsorted.
    2. The list is always sorted.
    3. The list contains unique elements only.
    4. The list size is always a power of two.
    5. The list is sorted in reverse order.
  3. Binary Search Requirements

    Which is a NECESSARY requirement for Binary Search to operate correctly?

    1. The array must be sorted.
    2. The array must contain only integers.
    3. The array must have an odd length.
    4. The array must be cyclic.
    5. All array elements must be positive.
  4. Comparative Efficiency in Practice

    Given a sorted array of 1,000,000 elements, which search algorithm is likely to find an element faster on average?

    1. Binary Search
    2. Linnear Search
    3. Linear Seach
    4. Lineer Search
    5. Jump Search
  5. Effect of an Unsorted Array

    If a list is NOT sorted, which of the following search algorithms can ALWAYS guarantee to find the target if present?

    1. Linear Search
    2. Binary Search
    3. Binari Search
    4. Expoential Search
    5. Jump Sarch
  6. Best Case Scenario

    What is the BEST CASE time complexity for Linear Search?

    1. O(1)
    2. O(log n)
    3. O(n)
    4. O(n log n)
    5. O(n^2)
  7. Practical Code Comparison

    Consider this code snippet: for (int i = 0; i u003C arr.length; i++) { if (arr[i] == target) return i; } What algorithm does it represent?

    1. Linear Search
    2. Binary Seach
    3. Binery Search
    4. Jump Search
    5. Exponential Search
  8. Binary Search Midpoint Calculation

    In Binary Search, how is the 'mid' index typically calculated to avoid integer overflow?

    1. mid = low + (high - low) / 2
    2. mid = (low / 2) + (high / 2)
    3. mid = low - (high + low) / 2
    4. mid = high / 2
    5. mid = (high + low) / 2
  9. Handling Duplicates

    If a sorted array contains duplicates, can Binary Search always find the FIRST occurrence of a target value?

    1. No, standard Binary Search finds an occurrence, not necessarily the first.
    2. Yes, it always finds the first occurrence.
    3. No, Binary Search does not work with duplicates.
    4. Yes, but only if all elements are distinct.
    5. Yes, if the array is sorted in ascending order only.
  10. Space Complexity Comparison

    What is the space complexity for both Linear and Binary Search (using iterative approach)?

    1. O(1)
    2. O(n)
    3. O(log n)
    4. O(n^2)
    5. O(0)