programb32 - Microprocessors & Applications (UPTU)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Appendix B  Explanation : Consider that a block of N words is present. Now we have to arrange these N words in ascending order, Let N = 4 for example. We will use SI as pointer to point the block of N words. Initially in the first iteration we compare first number with the second number. If first number < second number, don’t interchange the contents, otherwise if first number > second number swap the contents. In the next iteration we go on comparing the first number with third number. If first number < third number, don’t interchange the contents. If first number > third number then swaping will be done. Since the first two numbers are in ascending order the third number will go to first place, first number in second place and second number will come in third place in the second iteration only if first number > third number. In the next iteration first number is compared with fourth number. So on comparisions are
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

programb32 - Microprocessors &amp; Applications (UPTU)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online