Merge two Unsorted Array :

MERGE UNSORT () :
A is an Array with M elements and B is an array with N elements. C is an empty Array with LOC location where LOC >= M+N

Step I     : Repeat For I = 1 to M
Step II   : [ Assign elements of array A to array C ]  Set C[ I ]  = A[ I ]
[ End of For loop ]
Step III  : [ Counter Initialization ] Set K = 1
Step IV  : Repeat For J = M+1 to M+N
Step V   : [ Assign elements of array B to array C ]  Set C[ J ] = B[ K ]
Step VI  : [ Increase counter ] Set K = K + 1
[ End of For loop ]
Step VII : Exit

Leave a comment