#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
void insert(char *items, int count);
int main(void)
{
char s[255];
printf("Enter a string:");
gets(s);
insert(s, strlen(s));
printf("The sorted string is: %s.\n", s);
getch();
return 0;
}
void insert(char *items, int count)
{
register int a, b;
char t;
for(a=1; a < count; ++a)
{
t = items[a];
for(b=a-1; (b >= 0) && (t < items[b]); b--)
items[b+1] = items[b];
items[b+1] = t;
}
}
design an algorithm for Insertion Sort
No Answer is Posted For this Question
Be the First to Post Answer
What is this interview room ? Is it a class or an object.
What is a macro? And how is a macro same as a template?
What is abstraction and encapsulation?
what is cast operator?
how do you handle yourself when you feel the wald is aganist you
write a function that takes an integer array as an input and finds the largest number in the array. You can not sort array or use any API or searching needs?
2 Answers IBMS, Zycus Infotech,
What is difference between pop and oop?
How to overload new operator in c++
write a program to find 2^n+1 ?
Base class has two public data members. How can i derive a new class with one datamember as public and another data member as private?.
What is encapsulation in oop?
What is R T T I ?