Question: java 3. [10 points] The sorting algorithm on the following page is a variant of bubble sort (for arrays) where the direction of sorting changes
3. [10 points] The sorting algorithm on the following page is a variant of bubble sort (for arrays) where the direction of sorting changes within each iteration. a) Identify the best and worst cases for this sorting algorithm. b) Give an example of a best-case input array and an example of a worst-case input array. If it is not clear from your answer to part (a), explain why they are best-case and worst-case c) Determine and provide justification for the best-case and worst-case time complexity for this sorting algorithm, using Big-0 notation. You may use any rationale discussed in lecture to justify your time complexity estimates. No credit will be given for your time complexity analysis if you do not justify your nswers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
