Algorithm No One Knows About (2016)
11–20 of 200 posts
Re: Algorithm No One Knows About (2016)
#12>The misleading part in using the language of cards is that you don’t often consider a deck of size 2^64. What’s nice about the card formulation though is that it conveys how simple the problem statement really is. This is a fundamental problem that was open for a long time. Nobody knew how to deal cards. >The first obstacle that makes the “dealing” (without replacement) hard is that the “draw” method doesn’t work. I…
Re: Algorithm No One Knows About (2016)
#13[0]: https://en.wikipedia.org/wiki/Linear-feedback_shift_register
Re: Algorithm No One Knows About (2016)
#14>The misleading part in using the language of cards is that you don’t often consider a deck of size 2^64. What’s nice about the card formulation though is that it conveys how simple the problem statement really is. This is a fundamental problem that was open for a long time. Nobody knew how to deal cards. >The first obstacle that makes the “dealing” (without replacement) hard is that the “draw” method doesn’t work. I…
> How is this true? If you're drawing from a deck of 2^64 cards then unless you're drawing almost all of them there's not going to be any problem with rejection. Even if you're drawing 2^63 card you're going to be rejecting only half of your draws, so the average slowdown is going a factor of 2. It it though? I'm a but shoddy on my mathematics, but I'd wager from the birthday problem that you'd probably have to rejec…
Re: Algorithm No One Knows About (2016)
#15Why is hashmap not good enough for unique ID generation? const tweetIDs = {}; while(TWEET_COUNT){ const rnd = Math.random() * MAX_TWEET_ID; if(!tweetIDs[rnd]){ tweetIDs[rnd] = true; TWEET_COUNT--; } }
This will take longer time at each iteration and when both MAX_TWEET_ID and and TWEET_COUNT is large and close to (or equal to) each other it may take very long to complete.
Re: Algorithm No One Knows About (2016)
#16These seem to be fairly straight forward problems to solve- can anybody ELI5 why the Vitter algorithm is necessary?
Re: Algorithm No One Knows About (2016)
#17Earlier quoted context omitted.
That gets pretty slow and memory intensive once you sample a large amount of the total doesn’t it?
It was not a requirement :) However it won't get slow, it's O(1) to lookup if a key exists.
Re: Algorithm No One Knows About (2016)
#18Earlier quoted context omitted.
That gets pretty slow and memory intensive once you sample a large amount of the total doesn’t it?
It was not a requirement :) However it won't get slow, it's O(1) to lookup if a key exists.
Re: Algorithm No One Knows About (2016)
#19Earlier quoted context omitted.
> How is this true? If you're drawing from a deck of 2^64 cards then unless you're drawing almost all of them there's not going to be any problem with rejection. Even if you're drawing 2^63 card you're going to be rejecting only half of your draws, so the average slowdown is going a factor of 2. It it though? I'm a but shoddy on my mathematics, but I'd wager from the birthday problem that you'd probably have to rejec…
Birthday problem says that once you've gone through ~2^8 cards you've got a ~50% of having had to reject at least once. It takes 2^63 until you have a 50% chance of rejecting on each draw.
Re: Algorithm No One Knows About (2016)
#20Can't you use https://en.wikipedia.org/wiki/Lehmer_random_number_generator for this? I thought that was a common method of generating a random sequence without repetition. True, the result is not very random, but in most applications it doesn't make much of a difference.