Skip to content

Instantly share code, notes, and snippets.

@theorm
Created February 4, 2013 02:53
Show Gist options
  • Save theorm/4704769 to your computer and use it in GitHub Desktop.
Save theorm/4704769 to your computer and use it in GitHub Desktop.
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