Question: For the following sort algorithms, state whether the implementation included here is stable or unstable: In addition, state why it is stable or unstable. If



For the following sort algorithms, state whether the implementation included here is stable or unstable: In addition, state why it is stable or unstable. If you determine that it is unstable, a sample run of the program (copy/paste) is sufficient to show it is unstable. However, if the sort is stable, provide a convincing argument as to why you believe it is stable (sample runs may suggest it is stable, but you need to examine the code to be sure). For example, the Bubble Sort implementation is stable. It is stable because... Suppose a and b have equal sort keys and a appears before b in the original array. The sort code (bubble.h) only ever exchanges adjacent elements at line 21 . In order for b to come before a they will need to be swapped at line 21. However, if a and b have equal keys, the cmp function return false, thus the swap of these values will never happen
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
