{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Bucket Sort - int n,i,arr[max clrscr printf"Enter the...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<stdio.h> #include<conio.h> /* RISHI AGARWAL             BUCKET SORT    ROLL NO 02    SE CMPN A */ #define max 10 void display(int a[],int n) {  int i;  printf("\nLIST\n");  for(i=0;i<n;i++)  printf("%d ",a[i]); } void bucketsort(int x[],int n) {  int i,j,y[10];  for(i=0;i<10;i++)  y[i]=0;  for(i=0;i<n;i++)  y[x[i]]++;  for(i=0,j=0;i<n,j<n;i++)  {   while(y[i]-->0)   {    x[j++]=i;   }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
 } } void main()
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { int n,i,arr[max]; clrscr(); printf("Enter the no of data:"); scanf("%d",&n); printf("Enter the nos"); for(i=0;i<n;i++) scanf("%d",&arr[i]); //Displaying List display(arr,n); //Bucket Sort bucketsort(arr,n); //Displaying Sorted List display(arr,n); getch(); } OUTPUT: Enter the no of data:5 Enter the nos5 4 3 2 1 LIST 5 4 3 2 1 LIST 1 2 3 4 5 */...
View Full Document

  • Spring '07
  • THAKUR
  • #include, #define, RISHI AGARWAL, 02    SE CMPN, RISHI AGARWAL             BUCKET, int n,i,arr

{[ snackBarMessage ]}

Page1 / 3

Bucket Sort - int n,i,arr[max clrscr printf"Enter the...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online