#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 normal C constructs work differently in C++?
What is the types of inheritance?
What is difference between data abstraction and encapsulation?
What do you mean by variable?
what is SPL in c++.
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 the significance of classes in oop?
What is abstraction with example?
can you explain how to use JavaBean in Project
What does the keyword "static" mean?
i have to create a view in SQL as like in ORACLE DATA EXPRESS EDITION
program in c++ that can either 2 integers or 2 floating point numbers and output the smallest number