Re: [algogeeks] Amazon interview question

2012-05-24 Thread Aman Raj
array of bits? if the current integer is present set the bit if else make it zero, searching, insertion and deletion all in O(1) time. On Thu, May 24, 2012 at 4:15 PM, rishabh shukla rockrishabh.mn...@gmail.com wrote: Suggest a data structure for storing million trillion numbers efficiently

Re: [algogeeks] finding anagrams in a list of words

2012-05-11 Thread Aman Raj
use trie trees, and for every word sort the word and store the sorted word in the trie tree and also keep the index of that word in leaf of trie tree..after traversing the whole list of words you'll have all the indices of a anagrams of a particular word in its leaf nodes. On Fri, May 11, 2012

Re: [algogeeks] finding anagrams in a list of words

2012-05-11 Thread Aman Raj
if asking me..yes !! On Fri, May 11, 2012 at 5:27 PM, Raghavendhra Chowdary MV raghavendhra20061...@gmail.com wrote: Is this amazon question buddy?? On Fri, May 11, 2012 at 5:24 PM, mayur mayursa...@gmail.com wrote: Hi all, I am stuck with a question for a long time...can someone provide

Re: [algogeeks] How many games you will conduct to decide a winner for N players. Visualize in terms of a Data Structure.

2012-04-09 Thread Aman Raj
Ya tournament tree is fine, you can even check it on http://www.geeksforgeeks.org/archives/11556 To decide a winner among N people, ( n-1 ) people should loose. So N-1 games will decide. On Mon, Apr 9, 2012 at 12:45 AM, SAMM somnath.nit...@gmail.com wrote: This can be done using Tournament

Re: [algogeeks] Modified binary search

2012-04-09 Thread Aman Raj
how can there be multiple spikes and valleys?? say 1 2 3 4 5 6 7 if you rotate it once with rotation index 3 4 5 6 7 1 2 3 then again with index 2 6 7 1 2 3 4 5 So the multiple times rotation just means that the index of rotation is more then 1. On Fri, Apr 6, 2012 at 7:02 AM, Ashish Goel

Re: [algogeeks] Given an array A[1..n] of log n bit integers, sort them in-place in O(n) time

2012-04-04 Thread Aman Raj
Can you please explain the question again. As what I understood according to me the question is size of array : n and the range of the elements present at each location is log n. On Wed, Apr 4, 2012 at 2:57 AM, Doom duman...@gmail.com wrote: Any ideas? -- You received this message because

Re: [algogeeks] Vertical Sum in a given Binary Tree

2012-03-17 Thread Aman Raj
horizontal distance, 5 being the right child of 2 ( which is at -1 distance ) is again at -1 + 1=0 horizontal distance, similarly 6 will be at +1-1 =0 Horizontal distance. Hope that helps. Thanks and regards, Aman Raj On Sat, Mar 17, 2012 at 3:29 PM, rahul sharma rahul23111...@gmail.comwrote: what