logo CodeStepByStep logo


Language/Type: Python lists collections

Write a function named dual_selection_sort that is a modified version of the provided selection sort algorithm that selects both the largest and smallest elements on each pass and moves each of them to the appropriate end of the list. (As a side question: Will this algorithm be faster than a standard selection sort? What predictions world you make about its performance relative to the merge sort algorithm? What will its complexity class (Big-Oh) be?)

(Due to limitations of our site, we are unable to actually check whether you made the dual-select modification. We will check that your algorithm still sorts properly, but it is up to you or your TA/instructor to verify that you made the proper modification.)

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.