Selection sort method in Single dimensional array

Selection sort method is one of the must know the sorting algorithm for each and every computer science student.

In this sorting program, we are sorting an integer array of size 10 using bubble sort method.  This method is sorting this array into ascending order.

Selection sorting on a single dimensional array using functions. IN this sorting method first of all we try to find out lowest number available in the list and then swap that position’s value with the value available in that step position.

/* selection sort algorithm
made by :rakesh kumar
using namespace std;

void output(int a[],int n){
for(int i=0;i<n;i++)

void input(int x[],int n){
for(int i=0;i<n;i++)
cout<<“Enter x[“<<i+1<<“] number : “;

void selection_sort(int x[] ,int n)
int i,j,low,pos,temp;
low = x[i];
pos = i;
low = x[j];
pos= j;
temp = x[i];
x[i]= x[pos];
x[pos]= temp;


int main()
int x[10];
cout<<“\n sorted Array :”;
return 0;

Other most useful sorting algorithm are

  1. Bubble sort method program using single dimensional array
  2. Insertion sort method program using single dimensional array

If you need any other program on any sorting method, do post your request in comments.

Author: rakesh kumar is my online home, here I share all the information related to education, programming - and everything else that attract me. You can get in touch with me in these social sharing websites
Download File :

Leave a Reply