Consider the following Array [6,5,3,8,7,2,8]. Each of the following case below (
ID: 3738619 • Letter: C
Question
Consider the following Array [6,5,3,8,7,2,8]. Each of the following case below (A-E) is a view of a sort in prograss of the above Array which which? Each sort is used exactly once. In each case, Choose between BUBBLE SORT, SELECTION SORT, INSERTION SORT, MERGE SORT and QUICK SORT and Write down thier Corresponding Big O time complexities.
1. Case A: [5,3,6,7,2,4,8] which sorting algorith is used?
2. Case B: [5,6,3,8,7,2,4] which sorting algorith is used?
3. Case C: [2,5,3,7,8,6,4] which sorting algorith is used?
4. Case D: [2,5,3,4,6,8,7] which sorting algorith is used?
5. Case E: [3,5,6,2,4,7,8] which sorting algorith is used?
Explanation / Answer
1. Case A: [5,3,6,7,2,4,8] which sorting algorith is used?
Answer: QUICK SORT
2. Case B: [5,6,3,8,7,2,4] which sorting algorith is used?
Answer: INSERTION-SORT
Explanation: Since 5 is placed before 6 in 1st iteration Hence Insertion Sort is used.
3. Case C: [2,5,3,7,8,6,4] which sorting algorith is used?
Answer: SELECTION-SORT
=> Lest number 2 is placed at correct postion
4. Case D: [2,5,3,4,6,8,7] which sorting algorith is used?
Answer: MERGE-SORT, All Sorted Pairs
5. Case E: [3,5,6,2,4,7,8] which sorting algorith is used?
Answer: BUBBLE-SORT
Explanation: Since Higher number 7 IS PLACED at correct end , Hence bubble Sort is used.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.