[algogeeks] Re: find elements in array with odd frequency

2009-08-21 Thread Dufus

I can think of a naive algorithm which takes O(n) time and O(n) space.
or O(nlogn) with O(1) space.

May be someone else might come up with a better algo.

_dufus





On Aug 21, 3:01 pm, nagendra kumar  wrote:
> Given an array of integers,Print the integers whose appareance are in
> odd times.
> Need not worry abt order while printing the output.
> Need Algotithm in o(n) time complexity.
> Need efficient space complexity.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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
-~--~~~~--~~--~--~---



[algogeeks] find elements in array with odd frequency

2009-08-21 Thread nagendra kumar

Given an array of integers,Print the integers whose appareance are in
odd times.
Need not worry abt order while printing the output.
Need Algotithm in o(n) time complexity.
Need efficient space complexity.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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
-~--~~~~--~~--~--~---



[algogeeks] Re: Find an element in sorted matrix

2009-08-21 Thread Nagendra Kumar

If it is o(n) only then we can do a normal search. But data is sorted
left and down so how to use this property.

On Thu, Aug 20, 2009 at 8:12 PM, Dufus wrote:
>
> AFAIK, searching an element in sorted matrix (Young's Tableau) takes O
> (n) time.
> So I am not sure if O(logn) is actually possible.
>
> _dufus
>
>
>
> On Aug 20, 6:41 pm, nagendra kumar  wrote:
>> How can we find an element in the matrix [n*n] which is sorted row
>> wise and column wise in O(log n).
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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
-~--~~~~--~~--~--~---



[algogeeks] Re: Find an element in sorted matrix

2009-08-21 Thread stdazi

let i be in 1,n^2

use bisection on that interval taking i%n and i/n to access the matrix
and check the bisection condition.

On Aug 20, 4:42 pm, Dufus  wrote:
> AFAIK, searching an element in sorted matrix (Young's Tableau) takes O
> (n) time.
> So I am not sure if O(logn) is actually possible.
>
> _dufus
>
> On Aug 20, 6:41 pm, nagendra kumar  wrote:
>
> > How can we find an element in the matrix [n*n] which is sorted row
> > wise and column wise in O(log n).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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
-~--~~~~--~~--~--~---



[algogeeks] Re: Check divisibility by 3

2009-08-21 Thread Abhijeet Kumar
nice logic and to add simple too!!

-- 
Abhijeet

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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
-~--~~~~--~~--~--~---