Here is the code for [B][COLOR="Red"]Insertion Sort, Bubble Sort and Selection Sort[/COLOR][/B] [B]Insertion Sort[/B] [CODE] #include <stdio.h> main() { int i,j,key; int a[5]={5,2,3,4,1}; for(i=1;i<5;i++) { key=a[i]; while(i>0 && a[i-1]>key) { j=a[i]; a[i]=a[i-1]; a[i-1]=j; --i; } } int k; for(k=0;k<5;k++) {printf("%d ", a[k]);} printf("\n"); } [/CODE] [B]Bubble Sort[/B] [CODE] #include <stdio.h> main() { int i,j,x; int a[5]={5,2,3,4,1}; for(i=0;i<5;i++) { for(j=i+1;j<5;j++) { if(a[i]>a[j]) { x=a[i]; a[i]=a[j]; a[j]=x; } } } int k; for(k=0;k<5;k++) {printf("%d ",a[k]);} printf("\n"); }[/CODE] [B]Selection Sort[/B] [CODE] #include <stdio.h> main() { int i,j,x,min,k; int a[5]={5,3,2,4,1}; for(i=0;i<5;i++) { min=i; for(j=i+1;j<5;j++) { if(a[min]>a[j]) { min=j; } x=a[min]; a[min]=a[j]; a[j]=x; } } …

Member Avatar
Member Avatar
+0 forum 19

Hi...! In Design of Algorithm. I think it is used to calculate the time complexity.... What is meant by STEP-COUNT METHOD? What is the procedure in that to calculate? I want brief explination. ....

Member Avatar
Member Avatar
+1 forum 5

[B]RAPTOR SOFTWARE FOR XUBUNTU[/B] I'm feeling very difficulty to find RAPTOR software for XUBUNTU. Is there is any software like RAPTOR to draw flow charts. If you found plzz rply me.... Thank you.

Member Avatar
Member Avatar
+0 forum 5

Here is the codes for Binary Search and Linear Search. [B]Binary Search[/B] [CODE] #include<stdio.h> int main(){ int a[10],i,n,m,c=0,l,u,mid,j,x; //variable assigning printf("Enter the size of an array->"); //Entering the size of the array scanf("%d",&n); printf("\nEnter the elements of the array->");//Entering the array elements for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<n;i++) { //loop to sort the elements for(j=i+1;j<n;j++) { if(a[i]>a[j]) { x=a[i]; a[i]=a[j]; a[j]=x; } } } printf("\nThe elements of an array are->");//printing the sorted elements for(i=0;i<n;i++){ printf(" %d",a[i]); } printf("\nEnter the number to be search->");//Entering the key to be found scanf("%d",&m); l=0,u=n; while(l<=u){ //Here starts the coding for Binary search mid=(l+u)/2; if(m==a[mid]){ c=1; break; …

Member Avatar
+0 forum 0

If any body now about Browsers like TOR to open the blocked sites. Plz inform us. That as it will help us. or is there any software to increase the speed of the internet and also to open the blocked sites. .... Waiting for your response. Thank you.

Member Avatar
-1 forum 0

Plz send me the Gauss jordon code snippet or Hint that how to write the code for it. i.e i want for nXn order. Waiting for ur post. Bye

Member Avatar
+0 forum 0

[CODE] #include <stdio.h> #include<ctype.h> main() { int c,nletters[26],i; for (i = 0; i < 26; ++i) nletters[i] = 0; while ((c = getchar()) !='!') { if(isupper(c)) c=tolower(c); ++nletters[c - 'a']; } for (i = 0; i < 26; ++i) { c = 'a' + i; if(nletters[i] != 0){ putchar(c); printf(" = %d\n", nletters[i]);} } } [/CODE]

Member Avatar
Member Avatar
-1 forum 8

[TEX]This is a small Program i have written to perform the Basic Operations. Here is my code for it. Please suggest to improve more.................[/TEX]3 [CODE] #include <stdio.h> #include <string.h> int main() { char operator; int num1, num2; //char operation[1]={'\0'}; printf("Enter two numbers and operator to perform calculations!...\n"); printf("Enter the operator: "); scanf("%c",&operator); printf("Enter num1: "); scanf("%d",&num1); printf("Enter num2: "); scanf("%d",&num2); if (operator=='+') { printf("Sum is %d\n",num1+num2); } else if (operator=='-') { printf("Difference is %d\n",num1-num2); } else if (operator=='*'){ printf("Product is %d\n",num1*num2); } else if(operator=='/'){ printf("Ratio is %d\n",num1/num2); } else printf("Not given any Operation."); } [/CODE] [COLOR="Green"][TEX]OUTPUT..........[/TEX][/COLOR] [COLOR="Red"] [B] Enter two …

Member Avatar
Member Avatar
+0 forum 1

The End.