📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!

  • google app store apple app store
  • ✖

      Question

      Given the array [38, 27, 43, 3, 9, 82, 10], what would

      be the two sorted subarrays immediately *before the final merge step* in a Merge Sort algorithm?
      A [3, 9, 10, 27] and [38, 43, 82] Correct Answer Incorrect Answer
      B [27, 38] and [3, 9, 10, 43, 82] Correct Answer Incorrect Answer
      C [3, 27, 38, 43] and [9, 10, 82] Correct Answer Incorrect Answer
      D [3, 9, 27, 38] and [10, 43, 82] Correct Answer Incorrect Answer
      E [3, 9, 10] and [27, 38, 43, 82] Correct Answer Incorrect Answer

      Solution

      • The array has 7 elements

      • It is divided into:

        • Left half: [38, 27, 43, 3]

        • Right half: [9, 82, 10]

      Each half is independently fully sorted before the final merge. Sorting the left half [38, 27, 43, 3]

      Sorted → [3, 27, 38, 43] Sorting the right half [9, 82, 10]

      Sorted → [9, 10, 82] Just before final merge

      The two sorted subarrays are:

      • [3, 27, 38, 43]

      • [9, 10, 82]

      These two are then merged to produce the final sorted array:
      [3, 9, 10, 27, 38, 43, 82]

      Practice Next
      ask-question