Question: In this part, you will look at some further examples of how Strategy 2 performs compared to Strategy 1 . How many comparisons would Strategy
In this part, you will look at some further examples of how Strategy performs compared to Strategy
How many comparisons would Strategy take to sort a combined list of items?
Considering Strategy what is the greatest number of comparisons it could take to bubble sort the
first and second lists individually, then merge the results?
Comment briefly on the difference in performance.
i Merging two lists of length m and n respectively never needs more than m n comparisons.
This is because each comparison results in an item being moved to the merged list. If there are m n
items altogether then if we ever got to m n comparisons it would mean we had moved all but one
of the items to the merged list and the final item could be moved without any comparison.
This is the worst case; in general we are likely to need fewer than m n comparisons.
Suppose the first list contained items and the second list contained items.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
