#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
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
No Answer is Posted For this Question
Be the First to Post Answer
#include <iostream> using namespace std; int main() { int a = 2; int c[5][5]; for (int x=0;x<5;x++) { for (int y=0;y<5;y++) { c[x][y] = x*y; } } cout << c[a][c[1][4]]; }
what does exactly the linker do?
What is encapsulation selenium?
Why do we use oops?
why the argument is passed by reference to a copy constructor?example?
What polymorphism means?
What is this interview room ? Is it a class or an object.
What is the Advantage of Interface over the Inheritance in OOPS?
WILL I GET A guaranteed JOB AFTER DOING bsc()IT) and GNIIT from an NIIT CENTRE??
21 Answers Biocon, MIT, NIIT,
write a program to find 2^n+1 ?
What is a linked list?
Finding of the 4 larger (bigger) numbers from the list like{1245,4587,2145,1163,29987,65783.....}