You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,10 @@ For eg storing the minimum so far in another stack so that each time when a numb
65
65
- Sometimes to find largest element in an array, min heap can be made, for few first elements, and each
66
66
time comparisons can be done with remaining element to eliminate the minimum elements.
67
67
- Methods where min and max heap can be applied BST can also be used (depends on question)
68
+
- Sometimes a combination of min heap and max heap can be used to solve questions. Min heap can contain
69
+
maximum elements from array and max heap can contain minimum elements from array (this can be known at runtime without sorting the array). (refer question 7)
70
+
- Since each data structure has its own significance, sometimes it is good to use multiple data structures
71
+
like min heap + max heap + linked list as BST and so on for some algos to perform series of operations
68
72
69
73
# Topic0: Programming Questions
70
74
@@ -186,6 +190,7 @@ time comparisons can be done with remaining element to eliminate the minimum ele
186
190
-[Find a max element in a min-heap](/heaps/question4.c)
187
191
-[Build a min-heap and write algo to delete an arbitrary element](/heaps/question5.c)
188
192
-[Find k largest elements from an array](/heaps/question6.c)
193
+
-[Find median in a stream of numbers](/heaps/question7.c)
189
194
190
195
## Some important concepts to solve algos better
191
196
@@ -223,6 +228,8 @@ time comparisons can be done with remaining element to eliminate the minimum ele
223
228
- In a max heap, finding min, deleting random element or searching an element will take O(n) time because here max heap is as good as an array.
224
229
- For Binary Search tree implementation using an array, space complexity is O(2^n), but using linked list, it
225
230
is O(n)
231
+
- Stream of numbers mean the numbers are coming one after the other and for each input change you have to
0 commit comments