Question

[6 marks] Suppose we run three sorting methods on copies of an array containing 1, 7, 19, 24, 7, 49 (in that order). Suppose

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.In this median of three algorithm we first find the median of first and last

So in the array

1711912417149

the median of 1 and 49 will be 19 so the pivot element will be 19 no what will happen before the first loop is smaller then 19 will be on its left side ans larger or equal then 19 will be on right side

So the array before the 1st recursion will be:

171711912449

Which is sorted indeed

2. Radix sort sorts from least significant digit to the most significant digit

So at the end of first outer loop it will sort only according to the weightage of least significant digit so the array will be

[1247|19149

3.In merge sort first recursive call will only finish after all will finish because it will keep calling itself until the last returns so the array will be final array

171711912449

Add a comment
Know the answer?
Add Answer to:
[6 marks] Suppose we run three sorting methods on copies of an array containing 1, 7,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT