8086 program for selection sort


In this program we will see how to sort array elements in ascending order by using selection sort.

Problem Statement

Write 8086 Assembly language program to sort the elements in a given array using selection sort technique. The array is started from memory offset 501. The size of the series is stored at memory offset 500.

Discussion

In the selection sort technique, in each phase we are taking the smallest number from the array, swap the smallest element with the first element inside the array. Then move to second position, and check for second highest number form the second position to the end of the array, thus all of the elements are placed in the correct position to make them sorted.

The following image is showing how the sorting technique 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


 

Updated on: 30-Jul-2019

684 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements