Skip to content

Commit 3b87e40

Browse files
Update 295- Find median from data stream.md
1 parent 7fdbca6 commit 3b87e40

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dsa-solutions/lc-solutions/0200-0299/295- Find median from data stream.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,14 @@ print(mf.findMedian()) # Output: 1.5
167167
mf.addNum(3)
168168
print(mf.findMedian()) # Output: 2
169169
```
170+
</TabItem>
171+
</Tabs>
170172

171173
# Complexity Analysis
172-
## Time Complexity: O(log N) for addNum, O(1) for findMedian
174+
## Time Complexity: $O(log N)$ for addNum, $O(1)$ for findMedian
173175
### Reason:
174-
Adding a number involves heap insertion which takes O(log N) time. Finding the median involves looking at the top elements of the heaps, which takes O(1) time.
176+
Adding a number involves heap insertion which takes $O(log N)$ time. Finding the median involves looking at the top elements of the heaps, which takes $O(1)$ time.
175177

176-
## Space Complexity: O(N)
178+
## Space Complexity: $O(N)$
177179
### Reason:
178180
We are storing all the numbers in the two heaps.

0 commit comments

Comments
 (0)