williamkuszmaul

Joined 10 years ago

Karma
591
Submissions
59
Member since
Nov 19
View on Hacker News

Recent submissions

Comment · 3 years ago
Overall seems like a great book. The hashing chapter is a bit half baked though. It claims without reservation that deletions simply cannot be efficiently implemented with linear probing. But there are at least two two efficient to do this (lazy deletions or just fix up the hash table), and both are worthwhile for students to know.
Comment · 3 years ago
1/100 is too large of a cutoff imo. If you have a class of 96 students, there's a decent chance that an innocent student gets flagged for no reason. I hope he lets the student on the bubble off the hook.
Comment · 3 years ago
One thing I'm confused about: Did the author try vectorizing the linear search implementation? (Of course, it is possible that even if they did not, the compiler did.) I would imagine that vectorization is behind the advice to use linear searches on small arrays.
Comment · 3 years ago
Comment · 3 years ago
Comment · 4 years ago
Comment · 4 years ago
But does the question ever say "all"...?
Comment · 4 years ago
Unless I'm misreading, the question as stated in the blog post never says there is only one duplicate (there might be many!), so in that sense I think his answer may be wrong. A more robust solution is just to have an array of n counters and just count how many times each item appears.
Comment · 4 years ago
Using 64 bit integers, we can store the square of any 32 bit integer. Not that small...
Comment · 4 years ago
Impressive!

There are already implementations of sample sorting that are much faster than c++ sort (but I don't recall how much faster). I'd be very interested in a comparison to some of those...

Also, since we are sorting integers, I'd also be interested to know how well a modern implementation of radix sort can be made.

Comment · 4 years ago
If the coin were unbiased, we could compute the exact probability of getting 10231 or more heads with 20000 flips as:

"sum (20000 choose x)/2^20000 for x from 10231 to 20000",

which Wolfram Alpha evaluates to 0.00056.

The probability of getting a number of flips that differs from 10000 by at least 231 is twice that, so about 0.001.

So, in fact, the probability of this happening by dumb luck is about 1/1000. That's pretty strong evidence.

Comment · 4 years ago
From what I've heard, Perci Diaconis (one of the authors of the original paper) actually could do this. He was a magician before he became a mathematician, and a lot of his early mathematics work focused on math relating to the magic tricks he used to do

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton