Question: Trace the execution of selection sort for an array containing {9, 6, 0, 0, 7}, i.e., show the contents of the array after each iteration

  1. Trace the execution of selection sort for an array containing {9, 6, 0, 0, 7}, i.e., show the contents of the array after each iteration of the sorting algorithm.

  2. Trace the execution of insertion sort for an array containing {9, 6, 0, 0, 7}, i.e., show the contents of the array after each iteration of the sorting algorithm.

  3. merge sort is the prototypical example of a divide and conquer algorithm. In your own words, explain what happens during the divide portion of the algorithm and what happens during the conquer phase of merge sort.

  4. quick sort is another, but more complicated example, of a divide and conquer algorithm. Explain what happens during the partitioning phase of the algorithm and why the choice of a pivot is important for efficiency. In other words, what is the worst case big-Oh for this sorting method?

  5. Define stability of a sort and give at least one example of when it would be useful/needed. Which of the above sorts, if any, are stable?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!