Write Program Implements Iterative Merge Sort Program Repeatedly Read Arrays Format N Numb Q37119213

Write a program that implements ITERATIVE merge sort. Theprogram should repeatedly read arrays in the format: N (number ofnumbers in the array) followed by, on a new line, N numbersseparated by spaces. E.g.

8

4 1 9 6 8 1 19 5

When N == -1, the program stops. See data1.txt for the fileformat.

For each array that it reads, print the original array and thensort it with an ITERATIVE mergesort. To show the behavior of thealgorithm, after EACH call to merge, print ONLY THE RECENTLY MERGEDsection of the array as show in the sample run, run1.txt. Yourprogram output must match mine exactly, including

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.