programb33 - 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 descending 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 the first number with the second number. If first number > second number don’t interchange the contents. If first number < second number swap their contents. Now at the end of this iteration first two elements are sorted in descending order. In the next iteration we will compare the first number alongwith third. If first > third don’t interchange contents otherwise swap the contents. At the end of this iteration first three elements are sorted in descending order. Go on comparing till all the elements are arranged in descending order. This method requires approximately n comparisions.  Algorithm :
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

programb33 - 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