Tag Archives: sorting

Bubble sorting using function

#include<stdio.h> //Program for Bubble Sorting int * bubblesort(int*,int); int display(int *,int); int main() { int i,j,a[100],N,temp; printf(“Enter no.of elements you want to sort:\t”); scanf(“%d”,&N);//Max. no. of elements printf(“Enter %d elements you want to sort:\n”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore sorting:\t”); display(a,N); //Sorting … Continue reading

Posted in Data Structures with C | Tagged , , , , , , | Leave a comment

Selection Sorting in C

#include<stdio.h> //Program for Selection Sorting int main() { int i,j,a[100],N,temp; printf(“Enter no.of elements you want to sort:\t”); scanf(“%d”,&N);//max no. of elements printf(“Enter %d elements you want to sort:\n”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore sorting:\t”); for(i=0;i<N;i++) printf(“%d\t”,*(a+i)); //Sorting Starts for(i=0;i<N-1;i++) for(j=i+1;j<N;j++) if(a[i]>a[j]) { … Continue reading

Posted in Data Structures with C | Tagged , , , , , | Leave a comment

Bubble Sorting in C

#include<stdio.h> //Program for Bubble Sorting int main() { int i,j,a[100],N,temp; printf(“Enter no.of elements you want to sort:\t”); scanf(“%d”,&N);//Max. no. of elements printf(“Enter %d elements you want to sort:\n”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore sorting:\t”); for(i=0;i<N;i++) printf(“%d\t”,*(a+i)); //Sorting Starts for(i=0;i<N-1;i++) for(j=0;j<N-i-1;j++) if(a[j]>a[j+1]) { … Continue reading

Posted in Data Structures with C | Tagged , , , , | Leave a comment

Insertion Sorting

#include<stdio.h> //Program for Insertion Sorting int main() { int i,j,k,N,a[100],temp; printf(“Enter no. of elements you want to sort :\t”); scanf(“%d”,&N);//Max. no. of elements printf(“Enter %d elements you want to sort :\t”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore Sorting:\t”); for(i=0;i<N;i++) printf(“%d\t”,*(a+i)); //Sorting Process Start … Continue reading

Posted in Data Structures with C | Tagged , , , | Leave a comment

Quick Sort using recursion

//Quick sorting using Recursion #include<stdio.h> #include<stdlib.h> //Prototypes of functions used int * input(int *,int); int * sort(int *,int); void display(int*,int); int main() { int *a,n; printf(“Enter number of numbers you want to sort?\n”); scanf(“%d”,&n); a = input(a,n); a = sort(a,n);//call … Continue reading

Posted in Data Structures with C | Tagged , , , , | Leave a comment

linklist implementation using functions.

RCS file: lll.c,v Working file: lll.c head: 1.8 branch: locks: strict saurabh: 1.8 access list: symbolic names: keyword substitution: kv total revisions: 8; selected revisions: 8 description: created a linklist program where diff aspects are being done. first created new … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment