#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

Post New Answer

More OOPS Interview Questions

What is data binding in oops?

0 Answers  


Why we are use # in begning of programme of c++.

2 Answers   Syntel,


WAP to generate 2n+1 lines of the following pattern on the computer screen:

2 Answers  


officer say me - i am offered to a smoking , then what can you say

0 Answers  


Difference between realloc() and free?

9 Answers   HP,






what is the difference between a package and a software?

3 Answers  


what is namespace? what are the uses of namespace?

1 Answers  


What is this pointer in oop?

0 Answers  


WHAT IS ABSTRUCT DATA TYPE ? PLEASE EXPLAIN IT.

4 Answers   HCL,


what are the ways in which a constructors can be called?

0 Answers  


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

2 Answers  


what is pointers

7 Answers   Exilant,


Categories