ARRANGE AN ARRAY OF DATA IN ASCENDING ORDER


AIM:
 To write a program to arrange an array of data in ascending order

ALGORITHM:
 1.Initialize HL pair as memory pointer
 2.Get the count at 3200 into C – register
 3.Copy it in D – register (for bubble sort (N-1) times required)
 4.Get the first value in A – register
 5.Compare it with the value at next location.
 6.If they are out of order, exchange the contents of A –register and Memory
 7.Decrement D –register content by 1
 8.Repeat steps 5 and 7 till the value in D- register become zero
 9.Decrement C –register content by 1
 10.Repeat steps 3 to 9 till the value in C – register becomes zero





PROGRAM:




OBSERVATION:
 Input: 3200 05 (Array Size)
        3201 08
        3202 09
        3203 06
        3204 86
        3205 46
 Output: 3200 05(Array Size)
  3201 06
  3202 08
  3203 09
  3204 46
  3205 86
RESULT:
Thus the given array of data was arranged in ascending order.

1 comment:

  1. With havin so much content and articles ԁo you еνer run іnto any pгoblems of plagorism or copуright infringement?
    My blog hаs a lot of exclusive content I've either written myself or outsourced but it appears a lot of it is popping it up all over the internet without my permission. Do you know any solutions to help prevent content from being ripped off? I'd definitely appгеciate it.


    Нeгe is mу web blog :: cheap party pills

    ReplyDelete