Re:Nearly All Binary Searches and Mergesorts Are Broken (2006)
by trav4225 on Friday July 22, 2016 @09:34PM
(#12147938)
Hmm, I always figured it was just assumed that, unless otherwise specified, most well-known implementations fail with sufficiently large numbers.
[ Parent
| on HN ]
Re:Nearly All Binary Searches and Mergesorts Are Broken (2006)
by taneq on Friday July 22, 2016 @09:52PM
(#12147980)
All code running on a machine of finite size will fail (sometimes gracefully, usually not) for sufficiently large input values.
Re:Nearly All Binary Searches and Mergesorts Are Broken (2006)
by tgb on Saturday July 23, 2016 @02:45AM
(#12148625)
But the goal is only to work for the finite number of possible inputs allowed by the input types. There's no reason a finite machine has to fail on those.
Re:Nearly All Binary Searches and Mergesorts Are Broken (2006)
by Retric on Saturday July 23, 2016 @06:38AM
(#12149076)
Try to pass in data with zero bits of free memory.
Re:Nearly All Binary Searches and Mergesorts Are Broken (2006)
by tgb on Saturday July 23, 2016 @07:19AM
(#12149152)
It's not impossible to guarantee that a system has sufficient memory for all possible inputs. Look at high stakes embedded software development. You need more control than you get as an application on a desktop computer but there's nothing inherent about finite state machines that make them vulnerable.
Re:Nearly All Binary Searches and Mergesorts Are Broken (2006)
by mrich on Saturday July 23, 2016 @07:09AM
(#12149139)
That should still result in a clean error, not some kind of undefined behavior.
Re:Nearly All Binary Searches and Mergesorts Are Broken (2006)
by gfody on Friday July 22, 2016 @11:14PM
(#12148173)
Yep, this is just vintage click-bait.. you can bet more than sorting routines will fail with numbers approaching 2^63. It doesn't matter because if you're running quick sort on a list of 2^64 entries then something else is going wrong before your (l+r)/2 has a chance to overflow.
Re:Nearly All Binary Searches and Mergesorts Are Broken (2006)
by colejohnson66 on Saturday July 23, 2016 @02:47AM
(#12148629)
If you're trying to sort 2^63 items at once, you have other problems.
Re:Nearly All Binary Searches and Mergesorts Are Broken (2006)
by mrich on Saturday July 23, 2016 @01:55AM
(#12148533)
int in Java and C is 32 bit wide, not 64 bit, this limit is easily reached.
You cannot just assume nobody will use your algorithms with large inputs and act like your data types have unlimited range. Such bugs will typically manifest at important customers and be hard to analyze. Better think about your types beforehand and do add runtime checks!