How to sort the array A = [3, 9, 11, 12, 5] using: a. Insertion sort (showing the key and array modifications in each step) b. Merge sort (showing the floor and array modifications in each recursive call)
Added by Sally M.
Close
Step 1
Insertion sort: Show more…
Show all steps
Your feedback will help us improve your experience
Dr Harish Viswanathan and 66 other Algebra educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Use a merge sort to sort $b, d, a, f, g, h, z, p, o, k$ into alphabetic order. Show all the steps used by the algorithm.
Induction and Recursion
Recursive Algorithms
Write a program to merge two arrays. For example, consider two arrays A and B. Then, sort the arrays. Let's say I have A = {10, 25, 35, 40, 55} and B = {15, 30, 5, 20, 45, 65}. After sorting, A = {10, 25, 35, 40, 55} and B = {5, 15, 20, 30, 45, 65}. The merged array should be another array C with elements {5, 10, 15, 20, 25, 30, 35, 40, 45, 55, 65}. The resultant merged array should contain all the elements of A and B in sorted order. This doesn't mean that you can copy two arrays to the third array and sort the resultant array. However, you have to merge the contents of the two arrays by taking individual values of the two arrays one by one and insert them into the resultant array in the appropriate position so that it becomes sorted right after merging.
Liam H.
Use the insertion sort to sort the list in Exercise $36,$ showing the lists obtained at each step.
Algorithms
Recommended Textbooks
Elementary and Intermediate Algebra
Algebra and Trigonometry
Watch the video solution with this free unlock.
EMAIL
PASSWORD