134 karma · joined June 5, 2016
(1 - 2e-6)^(3e6) ≈ 0.002
So about 0.2%. Still highly unlikely but orders of magnitude more likely than what your normal distribution-detour gave.
> While I was working on this story, journalists at BBC News Russia confirmed the first known case of a murder being ordered on the dark web and successfully carried out by hired assassins.
But the point is not to drop small terms at the extremes - it is still an infinite sum. The point is to approximate sections of the function by rectangles, and those rectangles are a bad approximation around 0 too.
[0] https://twitter.com/Noahpinion/status/1015988356184866817
Why would the middle floor of a high rise be better than its ground floor?
Source / examples? Seems like a rather extraordinary claim.
[1] http://arthistory.rutgers.edu/menu-iii/current-students/curr...
EDIT: To be clear, going from left to right is not inherently 'easier' but it would be more consistent with our direction of writing.
No it does not? The axiom of countable choice [0] is a strictly weaker axiom.
[1] http://www.eea.europa.eu/data-and-maps/indicators/nitrate-in...
The way to fix this would be to let 'insert' return the node inserted at the given level. There already are a few returns in the 'insert' pseudocode right now, but it doesn't seem like anything is being returned right now.
Something like this:
-- Recursive skip list insertion function.
define insert(elem, root, height, level):
if right of root < elem:
return insert(elem, right of root, height, level)
else:
if level = 0:
new ← makenode elem
old ← right of root
right of root ← new
right of elem ← old
return new
else:
if level ≤ height:
new ← makenode elem
old ← right of root
right of root ← new
right of elem ← old
below new ← insert(elem, below root, height, level - 1)
return new
else:
return insert(elem, below root, height, level - 1)
Or more simply: define insert(elem, root, height, level):
if right of root < elem:
return insert(elem, right of root, height, level)
elif level > height:
return insert(elem, below root, height, level - 1)
else:
new ← makenode elem
old ← right of root
right of root ← new
right of elem ← old
if level > 0:
below new ← insert(elem, below root, height, level - 1)
return newEDIT: I was going to link a proof for this but it's surprisingly hard to find. IIRC, the idea is to use the median of medians algorithm ([1]) to pick the median for the pivot, and deal with values equal to the pivot by alternatingly placing them in the left and right partition, or alternatively just keep them in a third partition in the middle.
- The 88% poll appears to be conducted amongst (online) Telegraaf readers (here is an online version: http://www.telegraaf.nl/watuzegt/25920298/__Britten_moeten_i...) which is a bit comparable to the British 'Daily Mail'.. It's very anti-EU, and while it definitely has a large number of readers, the 88% is not at all representative of the Dutch population.
- The Ukraine referendum is mentioned, specifically: "The agreement itself is not that critical but the vote was widely used as a vote on the EU itself. It went against the EU by 61% to 32%, albeit on low turnout of only 32%.". The low turnout is relevant, a lot of people decided to strategically not vote in order to signal their dislike for the referendum itself. Although the minimum turnout (30%) was barely reached, the fact that this turnout was so low - combined with the fact that the anti-EU parties implicitly marketed it as an anti-EU vote - signals to me that much fewer people would vote against the EU in a referendum similar to the British one.
There is certainly a lot of anti-EU sentiment, but this article does appear to cherry pick its sources.
It's actually really simple. We'll write a and b in binary notation, for example:
a = 1001101
b = 0100111
Now what happens when you add two numbers in binary? We essentially add the numbers in each column together, and if it overflows, we carry to the next column (this is how you carry out addition in general).So what are the columns where we need to carry, the ones that overflow? These are given by (a&b) - the columns where both a and b contain a one. To actually carry we just move everything one position to the left: ((a&b)<<1). And what are the columns where we don't need to carry, the ones that don't overflow? These are the ones where we have exactly one zero, either in a or in b, so: a^b.
In other words, a + b = ((a&b)<<1) + (a^b). To compute the average, we divide by two, or in other words, we bitshift to the right by one place: (a + b)/2 = (a&b) + ((a^b)>>1)
If anything is unclear, feel free to ask :)
#include <iostream>
using namespace std;
int avg(int a, int b) {
return (a&b) + ((a^b)>>1);
}
int main() {
cout << avg(int(2e9), int(2e9 + 10)) << endl;
cout << avg(int(2e9), int(-2e9)) << endl;
cout << avg(int(-2e9), int(-2e9 - 10)) << endl;
return 0;
}
Gives: 2000000005
0
-2000000005