Merge sort is a technique to combine two sorted arrays. Merge sort takes two sorted input arrays X and Y—say of size m and n—and produces a sorted array Z of size m+n that contains all elements of the...


Merge sort is a technique to combine two sorted arrays. Merge sort takes two sorted


input arrays X and Y—say of size m and n—and produces a sorted array Z of size m+n


that contains all elements of the two input arrays. The pseudocode of merge sort is as


follows:


The merge sort algorithm scans the two input arrays while copying the smallest of the two elements from X and Y into Z. It updates indices appropriately. The first while loop terminates when one of the arrays is exhausted. Then the other array is copied into Z. Write a merge sort procedure and test it with two sorted arrays. Assume that the user enters the two input arrays in sorted (ascending) order. The merge sort procedure receives the five parameters via the stack.



May 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here