since we have to visit each value at least once we have to do at least O(n)
steps so there cant be a solution in time less than o(n)
but if the range of the values is limited we can use another array to count
the number of occurrences of each value
and the complexity would be:
o(n) time
o(max of th
how about using binary index tree??
On Tue, May 25, 2010 at 5:41 PM, liu yan wrote:
> I think you don't need to use the median number as pivot. As long as you
> use different number to do partition, after log(k) times recursive, the N
> element will be sorted.
>
> On Sun, May 23, 2010 at 3:17 PM
I think you don't need to use the median number as pivot. As long as you use
different number to do partition, after log(k) times recursive, the N
element will be sorted.
On Sun, May 23, 2010 at 3:17 PM, Jagadish M wrote:
> > Further to my previous post, one question.
> > Can the median be found
Hi,
Can anyone tell me what is the most efficient algo to find the mode.
Is it sorting and the then finding the max occurrence or can it be
done in time less than O(n) ?
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, s
let's break up that line you have in the end:
int(*f)(char) = (int(*)(char))foo ;
f('a') ;
it becomes clear that f has a return type of int. So the ambiguity is
resolved...
Anil
On Tue, May 25, 2010 at 2:25 PM, Anil C R wrote:
>
> Out of curiosity why would you do something like this?
> Anil
>
Out of curiosity why would you do something like this?
Anil
On Tue, May 25, 2010 at 12:45 PM, Modeling Expert <
cs.modelingexp...@gmail.com> wrote:
> If we have templatized functions , return type becomes part of
> function signature ( which is not the case when we have normal non-
> templatized
@abhijit : thanks a lot.
@sharad kumar : no MIT 2007 batch..
--
Thanks and Regards
Jayapriya Surendran
--
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 th
If we have templatized functions , return type becomes part of
function signature ( which is not the case when we have normal non-
templatized functions ) , So we can have two functions like these who
differ only in return type
template int foo(T)
{ cout << " this " ; }
template bool foo(T)
{ cou