Have a look : http://geeksforgeeks.org/?p=1488

On 15 December 2010 05:19, Saurabh Koar <saurabhkoar...@gmail.com> wrote:

> @ Bittu:
>
> Lets analyze your code with iterations:
>
> the array contains  1 3 3 1 2 3 5 2 3
> count contains       0 2 2 4 0 1 0 0 0
>
> now 1st iteration:
> i=8,7,6 the inner loop will nt be executed;
>
> i=5; so j=0 only; as count[5]=1;
> Now arr[pos](i.e array[0])=5
>
> i=4; the inner loop fails
>
> i=3; so j=0 to 3 as count[3]=4
> Now array[1]=array[2]=array[3]=array[4]=3
>
> i=2; so j=0 to 1 as count[2]=2
> so array[5]=array[6]=2
>
> and likewise array[7]=array[8]=1
>
> so the final array 5 3 3 3 3 2 2 1 1
>
> It doesnt match with the desired output.
>
> Correct me if I m missing something.
>
>
>
> On 12/15/10, bittu <shashank7andr...@gmail.com> wrote:
> > @ankur,saurabh,soumya......
> >
> > ya ankur i forget to remove range from dare also no need to find
> > range  for this..\
> >
> > put size-1 intead of range so that malloc will alocate the memory to
> > all  elements in array ..no hope its fine...
> >
> >
> > what i did is that
> > i took counter array  thta cvontains the  no of times particular
> > elements  comes
> > then i have sort d array in reverse  order...&  prints accoding to
> > count array..thats it... and the last line  of actual question says..
> >
> > """..in case of a tie  print the number which occurred first ""..i
> > don't think d way i hav solved dis......
> >
> > still please let me no..if m wrong..
> >
> > Regards
> > Shashank Mani Narayan " Don't b evil U can earn while u Learn"
> > Computer Science & enginerring
> > BIrla Institute of Technology,Mesra
> > Cell 9166674831
> >
> > --
> > 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<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.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to