varalu 0 Report post Posted November 13, 2007 Given an array of elements with many numbers occurring even number of times and two numbers occurring odd number of times. Find out the two numbers that occur odd number of times. example: Elements in array -- 14433446 The expected result is 1 and 6 One solution 1. Find max of the array 2. Hash Function : element/max value 3. Repeat to all elements... 4. Find frequency... yo will get the 2 elements with odd frequency. but this is not the optimal.... Do find more solutions to this and post it. Look for time and space complexity. Another Solution one more solution 1. Scan through the array 2. Insert the element into a BST if its already not there. If its already avl, delete it from BST. 3. Repeat for all the elements 4. Now, BST will have only the elements with odd occurrence. Time complexity : O(n*log n) Courtesy: Varun. (friend) Share this post Link to post Share on other sites