Skip to content

Instantly share code, notes, and snippets.

@brentluna
Created June 18, 2016 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brentluna/3b7d1ececcec80b515c658a2d55951d2 to your computer and use it in GitHub Desktop.
Save brentluna/3b7d1ececcec80b515c658a2d55951d2 to your computer and use it in GitHub Desktop.
def push(val)
# By using a little extra memory, we can get the max simply by peeking,
# which is O(1).
@store.push({
max: new_max(val),
min: new_min(val),
value: val
})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment