
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Sort Integer Array in Ascending Order Using 8086 Program
In this program we will see how to sort array elements in ascending order.
Problem Statement
Write 8086 Assembly language program to sort the elements in a given array, which is starts from memory offset 501. The size of the series is stored at memory offset 500.
Discussion
Here we are sorting the number in bubble sorting technique. In this sorting technique there will be n passes for n different numbers. In ith pass the ith largest element will be placed at the end. This is comparison based sort. We taking two consecutive numbers, compare them, and then swap them if the numbers are not in correct order. The following diagram is showing how the sorting is working.
Input
Address |
Data |
---|---|
… |
… |
500 |
06 |
501 |
51 |
502 |
24 |
503 |
2C |
504 |
CF |
505 |
3E |
506 |
45 |
… |
… |
Flow Diagram
Program
Output
Address |
Data |
---|---|
… |
… |
500 |
06 |
501 |
24 |
502 |
2C |
503 |
3E |
504 |
45 |
505 |
51 |
506 |
CF |
… |
… |
Advertisements