Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Find Median from Data Stream.md #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Solutions/Find Median from Data Stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ Instead of 2 heaps, you can use a self-balancing Binary Search Tree (like an AVL
1. Divide problem into 3 subproblems. Here are the groupings:
1. __Numbers < 0__: You have 2 options:
1. Use 2-heap solution (that we coded in original solution), or
1. Use 1 array, which represents 1 bucket
2. Use 1 array, which represents 1 bucket
1. __0 <= Numbers <= 100__: Use 100 buckets using an array of size 100
1. __100 < Numbers__: You have 2 options:
1. Use 2-heap solution (that we coded in original solution), or
1. Use 1 array, which represents 1 bucket
2. Use 1 array, which represents 1 bucket
1. For each number we get in the stream, insert it into 1 of the 3 groupings, keeping track of the count of numbers in each of these 3 groupings
1. To find the median, see which grouping the median must fall into and find it there.

Expand Down