[algogeeks] Re: Microsoft interview question

2012-05-21 Thread karthikeya s
No way u can do it in O(1) space and O(n) time.sols above are not gonna work..yeah, it is possible in O(n) space and O(n) time. On May 20, 12:29 am, HARSHIT PAHUJA hpahuja.mn...@gmail.com wrote: given 2 unsorted integer arrays a and b of equal size. Determine if b is a permutation of a.

[algogeeks] Re: Microsoft interview question

2012-05-21 Thread karthikeya s
^not an O(n) On May 21, 6:53 pm, Ashish Goel ashg...@gmail.com wrote: Dave, Cant we have a hash table with the item as key and its count as value (walk over array A and build HT). For permutation check, walk over second array and start reducing the count and remove when count becomes zero

[algogeeks] Re: Microsoft interview question

2012-05-21 Thread karthikeya s
in space On May 21, 6:53 pm, Ashish Goel ashg...@gmail.com wrote: Dave, Cant we have a hash table with the item as key and its count as value (walk over array A and build HT). For permutation check, walk over second array and start reducing the count and remove when count becomes zero for

[algogeeks] select k numbers

2012-03-17 Thread karthikeya s
You are given a dynamic stream of numbers and numbers are coming one by one. At a time you can store at max k numbers(coz you have only that much memory available). Task is that we have to select the random subset of size k from the numbers we have got so far with equal probability. -- You

[algogeeks] Re: Math Question

2012-03-15 Thread karthikeya s
@dave: +1 dude...:-) -- 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,

[algogeeks] Puzzle

2012-02-27 Thread karthikeya s
3, 39, 41, 43, 45, 49, 51, 53, 55, 64, ?, ?, ... (These are successive numbers sharing a common property. No math or outside knowledge is needed.) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Pbm with rand() function

2012-02-26 Thread karthikeya s
RAND() func returns value between 1 to INTMAX, as we know. But when smone tries to find out value between 1 to N he takes remainder of o/p of RAND() with N and adds one..but isn't it wrong coz RAND() will generate numbers with equal probability between 1 and INTMAX but taking remainder can

[algogeeks] Re: Pbm with rand() function

2012-02-26 Thread karthikeya s
int m = (RANDMAX / N) * N isn't m= RANDMAX simplyit couldn't understand the what is the logic here. -- 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

[algogeeks] generate random number

2012-02-26 Thread karthikeya s
Assuming we have an implementation of RANDOM(0.1), how can we implement RANDOM(a.b) - i.e. given we have a function that returns 0 OR 1 both with a probability of 1/2, how can we implement a function that returns integers from a to b (b a), all with a probability of 1/ n, where n = (b-a+1) my

[algogeeks] Re: Pbm with rand() function

2012-02-26 Thread karthikeya s
oh my bad.really nice concept+1 dave. -- 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] Re: Google-Puzzle

2012-02-25 Thread karthikeya s
buddy i said that kadane's algo(max subsum) wouldn't work.. On Feb 25, 1:31 pm, Ashish Goel ashg...@gmail.com wrote: max subsum problem Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, Feb 25, 2012 at 1:03 PM, karthikeya s

[algogeeks] Google-Puzzle

2012-02-24 Thread karthikeya s
You have a circular track containing fuel pits at irregular intervals. The total amount of fuel available from all the pits together is just sufficient to travel round the track and finish where you started. Given the the circuit perimeter, list of each fuel pit location and the amount of fuel

[algogeeks] use of sentinel in linked list

2012-02-21 Thread karthikeya s
How to implement a linked list using sentineli mean sentinel will be having some non-null address.then how would u identify it except remembering the address. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

[algogeeks] Re: use of sentinel in linked list

2012-02-21 Thread karthikeya s
@don,@gene: i know the pros of using it.but pbm occurs when we see pbm LIST-SEARCH(l,k) x - next[nil[l]] //nil[l] denotes the sentinel node while x != nil[l] and key[x] != k x - next[x] return x here to eliminate extra comparison (x != nil[l] ) in while loop ,

[algogeeks] Quick Sort

2012-01-28 Thread karthikeya s
How QuickSort is good in Virtual Memory Enviroment ? -- 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] content extraction

2011-10-13 Thread karthikeya s
Does anyone have an idea about how to extract content from a file irrespective of file format??? -- 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,