Merge Sort, Assembly Language

Write a program to merge two sorted arrays to create a third sorted array containing all values from the two original arrays.

Merge is a key component to the mergesort algorithm. Suppose we have two sorted array A and B. We want to create array C which contains all values from A and B, in sorted order. Merge looks at one element from each of A and B, and puts the smaller one into array C. When all elements of A or B have been copied into C, the remaining elements from the other array are copied into C.

The pseudocode for merge is:

while more elements in A and more elements in B { if curr element in A < curr element in B copy curr element in A to next position in C else copy curr element in B to next position in C } while more elements in A { copy all remaining elements in A to C } while more elements in B { copy all remaining elements in B to C }

Hint: Think carefully about the subscripts you need for the three arrays.

Prompt the user and read 7 numbers into A. Make sure the values are in order.

Prompt the user and read 5 numbers into B. Make sure the values are in order.

Merge these two arrays to create the array C.

Print the array C.
Posted Date: 12/8/2013 9:31:47 PM | Location : United States

Related Discussions:- Merge Sort, Assignment Help, Ask Question on Merge Sort, Get Answer, Expert's Help, Merge Sort Discussions

Write discussion on Merge Sort
Your posts are moderated
Related Questions
There are two parts to this assignment. The first part has you reading 4 integers representing; #QUARTERS, #DIMES, #NICKELS & #PENNIES, respectively. Your program should compute t

The Intel Processors :         The Intel Corporation is the biggest manufacturer  of microchips  in the world,  in addition  to being  the leading provider of chips for PCs. I

Write a program that allows a user to encrypt/decrypt a message using a shift cipher. The user should specify the key and the message. Your program should be able to handle messa

I can get it to copy the string but can''t get it to reverse it.

Perform an extensive web search of popular microcontroller manufacturers (some of the major players) to select a suitable device for the system to control the lighting of a typical

You are to create an assembly program for the MSP430 that correctly measures the wind direction, to a precision of 45° (N, NW, W, SW, S, SE, E, NE), using the MSP430's ADC. Your

Project Description: Write an 80x86 assembly program that performs the following functions: Reads a set of integers from a file into an array. The data file name is to be

Pin diagram of 8088 : The pin diagram of 8088 is shown in given figure. Most of the 8088 pins and their functions are exactly similar to the corresponding pins of 8086.  Hence

Computes the integral square root: Problem: Square Root:   For this problem you will write a short assembly program that computes the integral square root of an input numb

External Hardware-Interrupts External hardware-interrupts are generated by controllers of external devices or coprocessors and are connected to the processor pin for Non Mask a