Keep inserting elements in a binary search tree and break once you get
the find the element in the tree.
Complexity=O(n log n)
On 10/5/10, sourav souravs...@gmail.com wrote:
You are given an array of positive numbers in which one number is
repeated. Rest all are present only once. Find the
can u do dis problem in linear time, o(n)??
On Wed, Oct 6, 2010 at 4:20 PM, Mukesh Gupta mukeshgupta.2...@gmail.comwrote:
Keep inserting elements in a binary search tree and break once you get
the find the element in the tree.
Complexity=O(n log n)
On 10/5/10, sourav souravs...@gmail.com
keep inserting the values as key in a hashmap where corresponding value
represents no of occurrence of key.
Break if count ==2.
Time O(n) .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
You are given an array of positive numbers in which one number is
repeated. Rest all are present only once. Find the duplicate number in
linear or sub linear time.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send