#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 the difference between procedural programming and oops?

0 Answers  


Write a program to get the binary tree.

3 Answers   ABC,


Generally, in all C++ programs, texts are in white colour. Can we change the colour of the text(either input or output or both)? If so, help me out.

1 Answers  


Program to open a file with First argument

1 Answers   TCS,


What is the difference between pass by reference and pass by value?

12 Answers   Pfizer, TCS,


explain dynamic binding by drowing

2 Answers   Cognizant,


There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.

0 Answers  


What are the advantanges of modularity

2 Answers  


What are the valid types of data that the main () can return in C/C++ language

3 Answers  


Can an interface inherit a class?

0 Answers  


What is coupling in oop?

0 Answers  


What is R T T I ?

6 Answers   Ness Technologies,


Categories