I think ankur khanna's solution is appropriate. couldn't get what bittu was trying to do completely.. could you just explain it once please!
On Wed, Dec 15, 2010 at 10:35 AM, Soumya Prasad Ukil <ukil.sou...@gmail.com>wrote: > bittu, in stead of writing your code, put your logic here. It is not the > place to show how capable one is to write a program. > > On 14 December 2010 11:00, bittu <shashank7andr...@gmail.com> wrote: > >> #include <stdlib.h> >> #include<stdio.h> >> #include<conio.h> >> >> >> int main() >> { >> int array[]={1,3,3,1,2,3,5,2,3}; >> int size=sizeof(array)/sizeof(int); >> int min,max; >> max=min=array[0]; >> int i=0; >> >> for(i = 1; i < size; i++) >> { >> if (array[i] < min) >> min = array[i]; >> else if (array[i] > max) >> max = array[i]; >> } >> >> int range = max - min + 1; >> int *count =(int *) malloc(range * sizeof(int)); >> >> for(i = 0; i < size; i++) >> count[i] = 0; >> >> for(i = 0; i < size; i++) >> count[array[i]]++; >> >> >> >> int pos=0; >> >> for(i=size-1;i>=0;i--) >> { >> for(int j=0;j<count[i];j++) >> { >> array[pos]=i; >> pos++; >> } >> } >> //free(count); >> >> for(int i=0;i<size;i++) >> printf("%d \n" ,array[i]); >> >> getch(); >> } >> >> in case of a tie >> print the number which occurred first ...i think dis situation never >> occurs...as ..array is sorted.. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algoge...@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > regards, > soumya prasad ukil > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.