SELECTION SORT

If you have any queries please leave a message here
Your Message
×


Selection Sort for sorting a list L of n numbers, represented by an array A[1 . . n], proceeds by finding the minimum element of the array and placing it in the first position of the array representing the list. Then repeat the process on the subarray representing the sublist obtained from the list by excluding the current minimum element.





Selection Sort Programming in C

#include<stdio.h>
void main()
{
int a[]={ 80, 32, 28, 110, 50 };
int i, j, temp, index;
for(i=0; i<4; i++)
{
index = i;
for(j=i+1; j<5; j++)
{
if(a[index] > a[j])
index = j;
}
if(index != i)
{
temp=a[i];
a[i]=a[index];
a[index]=temp;
}
}
for(i=0; i<5; i++)
{
printf("\t%d",a[i]);
}
}



ABOUT US

QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries.

Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions.

Moreover, QuestionSolves.com provides solutions to your questions and assignments also.


MORE TOPIC


Windows Command

UNIX Command

IGNOU Assignment Solution

IGNOU Question Paper Solution

Solutions of Different Questions


WHAT WE DO


Website Devlopment

Training

Home Learning

Provide BCA, MCA Projects

Provide Assignment & Question Paper Solution


CONTACT US


Follow Us