← Quiz: Merge Sort and Quick Sort: all 13 questions
Quiz: Merge Sort and Quick Sort · Question 11 of 13
In the merge step, why use a[i] <= b[j] rather than a[i] < b[j]?
In the merge step, why use a[i] <= b[j] rather than a[i] < b[j]?
- A.On equal values it takes the item from the left half first, which keeps merge sort stable
- B.It makes the merge faster
- C.With < the output would not be sorted
- D.It avoids an index error
Answer & explanation
Correct answer: On equal values it takes the item from the left half first, which keeps merge sort stable
Equal items keep their original order only if the left one is taken first.
Can you get the rest right without peeking?
Take the timed Quiz: Merge Sort and Quick Sort quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →