Java Program :
class selsort_d
{
static void sort(int a[])
{
int i,j,c,k;
for(i=0;i<a.length-1;i++)
{
c=i+1;
for(j=0;j<a.length-1-i;j++)
{
if(a[i]<a[c])
{
k=a[c];
a[c]=a[i];
a[i]=k;
}
c++;
}
}
System.out.print("Sorted array : ");
for(i=0;i<a.length;i++)
System.out.print(a[i]+" ");
}
}
class selsort_d
{
static void sort(int a[])
{
int i,j,c,k;
for(i=0;i<a.length-1;i++)
{
c=i+1;
for(j=0;j<a.length-1-i;j++)
{
if(a[i]<a[c])
{
k=a[c];
a[c]=a[i];
a[i]=k;
}
c++;
}
}
System.out.print("Sorted array : ");
for(i=0;i<a.length;i++)
System.out.print(a[i]+" ");
}
}
bad...good...sarahua....!!! @#$% #$#
ReplyDeleteIt will necer work
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis coding does not work. I have tried.
ReplyDeleteThanks for sharing this useful post about Java Selection Sort Program .
ReplyDeletethe program is wrong
ReplyDeleteArre bro ye toh bubble sort hai😡 😡 😡
ReplyDeleteNot SELECTION SORT!!!!!!!!
ReplyDelete