Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the data provided, which of the above algorithm is more efficient and why? Hints: Please consider counting the number of comparisons made by each
Using the data provided, which of the above algorithm is more efficient and why? Hints: Please consider counting the number of comparisons made by each algorithm. Please show your work and motivate your answer.
Bubble Sort | |||||||||
54 | 25 | 93 | 17 | 77 | 31 | 44 | 55 | 45 | |
pass 1 | 25 | 54 | 17 | 93 | 77 | 31 | 44 | 55 | 45 |
pass 2 | 25 | 54 | 17 | 77 | 93 | 31 | 44 | 55 | 45 |
pass 3 | 25 | 54 | 17 | 77 | 31 | 93 | 44 | 55 | 45 |
pass 4 | 25 | 54 | 17 | 77 | 31 | 44 | 93 | 55 | 45 |
pass 5 | 25 | 54 | 17 | 77 | 31 | 44 | 55 | 93 | 45 |
pass 6 | 25 | 54 | 17 | 77 | 31 | 44 | 55 | 45 | 93 |
pass 7 | 25 | 17 | 54 | 77 | 31 | 44 | 55 | 45 | 93 |
pass 8 | 25 | 17 | 54 | 31 | 77 | 44 | 55 | 45 | 93 |
pass 9 | 25 | 17 | 54 | 31 | 44 | 77 | 55 | 45 | 93 |
pass 10 | 25 | 17 | 54 | 31 | 44 | 55 | 77 | 45 | 93 |
pass 11 | 25 | 17 | 54 | 31 | 44 | 55 | 45 | 77 | 93 |
pass 12 | 17 | 25 | 54 | 31 | 44 | 55 | 45 | 77 | 93 |
pass 13 | 17 | 25 | 31 | 54 | 44 | 55 | 45 | 77 | 93 |
pass 14 | 17 | 25 | 31 | 44 | 54 | 55 | 45 | 77 | 93 |
pass 15 | 17 | 25 | 31 | 44 | 54 | 45 | 55 | 77 | 93 |
pass 16 | 17 | 25 | 31 | 44 | 45 | 54 | 55 | 77 | 93 |
Selection | |||||||||
54 | 25 | 93 | 17 | 77 | 31 | 44 | 55 | 45 | |
pass 1 | 17 | 25 | 93 | 54 | 77 | 31 | 44 | 55 | 45 |
pass 2 | 17 | 25 | 93 | 54 | 77 | 31 | 44 | 55 | 45 |
pass 3 | 17 | 25 | 31 | 54 | 77 | 93 | 44 | 55 | 45 |
pass 4 | 17 | 25 | 31 | 44 | 77 | 93 | 54 | 55 | 45 |
pass 5 | 17 | 25 | 31 | 44 | 45 | 93 | 54 | 55 | 77 |
pass 6 | 17 | 25 | 31 | 44 | 45 | 54 | 93 | 55 | 77 |
pass 7 | 17 | 25 | 31 | 44 | 45 | 54 | 55 | 93 | 77 |
pass 8 | 17 | 25 | 31 | 44 | 45 | 54 | 55 | 77 | 93 |
Insertion | |||||||||
54 | 25 | 93 | 17 | 77 | 31 | 44 | 55 | 45 | |
pass 1 | 25 | 54 | 93 | 17 | 77 | 31 | 44 | 55 | 45 |
pass 2 | 25 | 54 | 93 | 17 | 77 | 31 | 44 | 55 | 45 |
pass 3 | 25 | 54 | 17 | 93 | 77 | 31 | 44 | 55 | 45 |
pass 4 | 25 | 17 | 54 | 93 | 77 | 31 | 44 | 55 | 45 |
pass 5 | 17 | 25 | 54 | 93 | 77 | 31 | 44 | 55 | 45 |
pass 6 | 17 | 25 | 54 | 77 | 93 | 31 | 44 | 55 | 45 |
pass 7 | 17 | 25 | 54 | 77 | 31 | 93 | 44 | 55 | 45 |
pass 8 | 17 | 25 | 54 | 31 | 77 | 93 | 44 | 55 | 45 |
pass 9 | 17 | 25 | 31 | 54 | 77 | 93 | 44 | 55 | 45 |
pass 10 | 17 | 25 | 31 | 54 | 77 | 44 | 93 | 55 | 45 |
pass 11 | 17 | 25 | 31 | 54 | 44 | 77 | 93 | 55 | 45 |
pass 12 | 17 | 25 | 31 | 44 | 54 | 77 | 93 | 55 | 45 |
pass 13 | 17 | 25 | 31 | 44 | 54 | 77 | 55 | 93 | 45 |
pass 14 | 17 | 25 | 31 | 44 | 54 | 55 | 77 | 93 | 45 |
pass 15 | 17 | 25 | 31 | 44 | 54 | 55 | 77 | 45 | 93 |
pass 16 | 17 | 25 | 31 | 44 | 54 | 55 | 45 | 77 | 93 |
pass 17 | 17 | 25 | 31 | 44 | 54 | 45 | 55 | 77 | 93 |
pass 18 | 17 | 25 | 31 | 44 | 45 | 54 | 55 | 77 | 93 |
Quick sort | |||||||||
54 | 25 | 93 | 17 | 77 | 31 | 44 | 55 | 45 | |
pass 1 | 54 | 25 | 17 | 31 | 44 | 55 | 45 | 77 | 93 |
pass 2 | 17 | 25 | 54 | 31 | 44 | 55 | 45 | 77 | 93 |
pass 3 | 17 | 25 | 31 | 54 | 44 | 55 | 45 | 77 | 93 |
pass 4 | 17 | 25 | 31 | 44 | 54 | 55 | 45 | 77 | 93 |
pass 5 | 17 | 25 | 31 | 44 | 54 | 45 | 55 | 77 | 93 |
pass 6 | 17 | 25 | 31 | 44 | 45 | 54 | 55 | 77 | 93 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started