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
Program :  Write an assembly program to find out the largest number from a given unordered array of 8-bit numbers that stored in the locations starting from a known address. S

write a Mips program that read a string AND PRINT IT ON THE SCREEN

Why is the capability to relocate processes desirable?

I need some guidance on which project to make in assembly language

1. Write an assembly program that adds the elements in the odd indices of the following array. Use LOOP. What is the final value in the register? array1 DWORD 10, 20, 30, 40, 50, 6

How to write an assembly program The initial step in writing an assembly language program is to identify and study the problem. After studying the problem, choose the logical m

Write a program to calculate the first 20 numbers of Fibonacci series. Use the stack (memory) to store the calculated series. Your debugger output should look like the following sc

The addressing modes for the sequential control transfer instructions are described below:   1. Immediate: Immediate data is a part of instruction,in this type of addressin

SBB: Subtract  with Borrow  :- The subtract with borrow instruction subtracts the source operand and the borrow flag (CF) which might reflect the result of the past calculations,

1- Write an assembly program that:   a- Defines an array of 10 (word type)elements;   b- Finds out the number of negative elements   c- Calculate the summation of the posi