03-08-2013, 02:32 PM
ARRANGE AN ARRAY OF DATA IN ASCENDING ORDER
AIM:
To write a program to arrange an array of data in ascending order
ALGORITHM:
Initialize HL pair as memory pointer
Get the count at 4200 into C – register
Copy it in D – register (for bubble sort (N-1) times required)
Get the first value in A – register
Compare it with the value at next location.
If they are out of order, exchange the contents of A –register and Memory
Decrement D –register content by 1
Repeat steps 5 and 7 till the value in D- register become zero
Decrement C –register content by 1
Repeat steps 3 to 9 till the value in C – register becomes zero
RESULT:
Thus the given array of data was arranged in ascending order.