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.
^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
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
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
@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,
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
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
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
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
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
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
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
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,
@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 ,
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
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,
16 matches
Mail list logo