#include
#include
#include
#include
void select(char *items, int count);
int main(void)
{
char s[255];
printf("Enter a string:");
gets(s);
select(s, strlen(s));
printf("The sorted string is: %s.\n", s);
getch();
return 0;
}
void select(char *items, int count)
{
register int a, b, c;
int exchange;
char t;
for(a = 0; a < count-1; ++a)
{
exchange = 0;
c = a;
t = items[ a ];
for(b = a + 1; b < count; ++b)
{
if(items[ b ] < t)
{
c = b;
t = items[ b ];
exchange = 1;
}
}
if(exchange)
{
items[ c ] = items[ a ];
items[ a ] = t;
}
}
}
design an algorithm for Selection Sort
2496
How can we refresh automatically when new data has entered the database?
1056
Why mysql is used with php?
923
How to trouble shoot if unable to connect SQL Server
1928
What is meaning of 'assign' keyword?
819
What are recursion nodes ?
310
Does apple use linux or unix?
795
How you get the ticket?
1062
What are the different database types in rds?
230
What is standalone command task?
1267
How the values are ordered in an array?
1017
How many public class files are possible to define in Scala source file?
7
What is c++ & why it is used?
1034
What is ExcelConnector in OpenSpan?
5
How do you convert byte array to hexadecimal string, and vice versa?
1041