Question: python programming QUESTION 4 [TOTAL MARKS: 25] Consider the following list of integers. 28 17 18 25 16 9 22 4 13 8 5 1
QUESTION 4 [TOTAL MARKS: 25] Consider the following list of integers. 28 17 18 25 16 9 22 4 13 8 5 1 4(a) [5 Marks] Write out the state of the list above after the first three iterations of the main/outer loop of the selection-sort algorithm. 4(b) [5 Marks) Write out the state of the list above after the first three iterations of the main/outer loop of the insertion-sort algorithm. 4(c) [5 Marks) Using big-o notation, state the worst-, average- and best-case complexity of the linear-search algorithm. 4(d) [5 Marks] Using big-O notation, state the worst-, average- and best-case complexity of the binary-search algorithm. 4(e) [5 Marks] Assume a sorted list a. Under what circumstances, if any, might linear search in a be preferred over binary search
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
