To the Top
File:  root - text - article - 2019 - 12 - running-median.txt.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 361 Views, 15516 Search Bots | 49 Words

Subscribe to Feed Burner | Browse | Archive
Hi, here's your problem today. This problem was recently asked by Google:

You are given a stream of numbers. Compute the median for each new element .

Eg. Given [2, 1, 4, 7, 2, 0, 5], the algorithm should output [2, 1.5, 2, 3.0, 2, 2, 2]

Here's a starting point:


def running_median(stream):
# Fill this in.

running_median([2, 1, 4, 7, 2, 0, 5])
# 2 1.5 2 3.0 2 2.0 2
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 361 Views, 15516 Search Bots | 49 Words Subscribe to Feed Burner

Related Articles

  1. Sort a Partially Sorted List
  2. Windows Scripting
  3. Daily Interview Problem: Min Range Needed to Sort
  4. Spreadsheet Columns
  5. Daily Interview Question: Longest Sequence with Two Unique Numbers
  6. Daily Interview Problem: Word Ordering in a Different Alphabetical Order
  7. Find the non-duplicate number
  8. Daily Interview Problem: Find the k-th Largest Element in a List
  9. Daily Interview Puzzle: Ways to Traverse a Grid
  10. Algorithm Interview: Determine If Linked List is Palindrome

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />