#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

Whats is abstraction in oops?

0 Answers  


#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]]; }

2 Answers   TCS, Wipro,


What is encapsulation oop?

0 Answers  


Can a destructor be called directly?

0 Answers  


What are virtual functions?

2 Answers  






Write pseudo code for push in a stack?

2 Answers   emc2,


What is the advantage of oop over procedural language?

0 Answers  


What is protected in oop?

0 Answers  


What's the full form of STL?

2 Answers  


in the following, A D B G E C F Each of the seven digits from 0,1,2,3,4,5,6,7,8,9 is: a)Represented by a different letter in abov fig: b)Positioned in the fig abov so tht A*B*C,B*G*E,D*E*F are equal. wch does g represents? C

1 Answers   IonIdea,


How to deploy web appliction in web logic ?

1 Answers   Unisys,


What is variable example?

0 Answers  


Categories