Merge Sort, Assembly Language

Assignment Help:
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.

Related Discussions:- Merge Sort

8237 modes-microprocessor, 8237 modes : Intel 8237 can be set to four d...

8237 modes : Intel 8237 can be set to four different type of style of transfer: 1) Single - One transfer at a time,  it allow processor access to the bus between transfers

Register organization of 8086-microprocessor, Register Organization of 8086...

Register Organization of 8086 8086  has  a great  set  of registers  containing  special  purpose and general  purpose  registers.  All the 8086 resisters are 16-bit registers.

Operating System, Why is the capability to relocate processes desirable?

Why is the capability to relocate processes desirable?

Counting Array Values(Programming exercises), Write an application that doe...

Write an application that does the following:(1) fill an array with 50 random integers; (2) loop through the array, displaying each value, and count the number of negative values;

Dma-how dma works-microprocessor, DMA DMA stands for Direct Memory ...

DMA DMA stands for Direct Memory Access It is uses same Address/Data lines on ISA bus It controls the ISA bus instead of the processor ("bus master") Floppy

Odd and even numbers, hi, i''m new to assembly language and my teacher told...

hi, i''m new to assembly language and my teacher told us to look for an example of the odd and even numbers program using debug.exe in ms dos as a guide since we just started. plea

Computes the integral square root - assembly program, Computes the integral...

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

Program, Write a program to separate out positive and negative numbers from...

Write a program to separate out positive and negative numbers from a given series of 16-bit hexadecimal numbers.

Cache memory-microprocessor, Cache Memory Caching is a technology based...

Cache Memory Caching is a technology based on the memory subsystem of any computer. The majoraim of a cache is to accelerate the computer while keeping the cost of the computer

Synchronous and asynchronous transmissions of 8251, Typical link to modems ...

Typical link to modems for synchronous and asynchronous transmissions are shown in Figure. With regard to the synchronous connections it is consider that the timing is controlled

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd