Created
February 4, 2013 02:53
-
-
Save theorm/4704769 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. | |
=============== | |
xxx// Can you sehis? | |
// Given as input: 3 + 4 + 6 * 7 * 2 + 8 ... | |
// Assume just single digits, + and * | |
// Evaluate it. | |
// Walk through the following case: | |
// 3 | |
result = 0 | |
buffer = 0 | |
op = '+' | |
def consume_stream(v): | |
if v in ['+','*']: | |
op = v | |
else: | |
if op == '+': | |
result += int(v) | |
buffer = int(v) | |
elif op == '*': | |
result -= buffer | |
buffer *= int(v) | |
result += buffer | |
2. | |
============== | |
Imagine there are 1000 worker nodes, 1 coordinator node with (4GB RAM), and 10 billion numbers are distributed amongst the worker nodes. | |
i) Find the mean. | |
ii) Find the median. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment