Quiz Mergesort - Stability

Ace your homework & exams now with Quizwiz!

Here are three descriptions of stable algorithms. One of the descriptions is false. Which one is it? -They preserve the relative order of items with equal keys. -They ensures that all elements are in ascending order. -They ensure that if an array has been sorted by a given key and then we sort it by a second field it maintains the original sort for all elements that have equal keys in that second field.

They ensures that all elements are in ascending order.

Check all algorithms that are stable -Mergesort -Selection Sort -Insertion Sort

- Mergesort - Insertion Sort

Mergesort is a stable sorting algorithm as long as the merge method is implemented correctly. Which of the following should you do if you want to ensure that your implementation of the merge method results in a stable mergesort? -If 2 keys are equal it takes the element from the right subarray -If 2 keys are equal it takes the element from the left subarray -If 2 keys are equal it takes the element from the subarray that was accessed last.

If 2 keys are equal it takes the element from the left subarray

A sorting algorithm is stable if equal items are never moved past each other

True


Related study sets

Chapter 9: Torts and Products Liability

View Set

Chapter 4 Tissue: The Living Fabric

View Set

Chapter 5: Early Society in East Asia, history of world civilization midterm, HIS 111, WTWA Ch. 3, WTWA Fall Trimester Test, History 1110 Module 1 Test, GPS Test 1, GPS Test 2, gps test 3, WTWA Ch. 6-7, WTWA, Ch. 1-2, WTWA Ch. 1-2 Follow-up, WTWA Ch....

View Set