Тёмный

Leetcode 295. Find Median from Data Stream Intuition + Code C++ Example 

Code with Alisha
Подписаться 29 тыс.
Просмотров 7 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 29   
@chetanmittal660
@chetanmittal660 9 месяцев назад
whenever i am stuck in any question this is the only channel which i trust.
@Auto_Enthusiast
@Auto_Enthusiast Год назад
hats off👌👌 , for showing your mistake in video , otherwise many youtubers only edit mistake part and only show successful thing
@pranamyavadlamani5979
@pranamyavadlamani5979 2 года назад
I think when we have 1,3,4 in the list, the median would be 3. I'm guessing you said (1+3)/ 2 by mistake here Alisha!
@MohdDanish-kv8ry
@MohdDanish-kv8ry Год назад
Yes, just noticed.
@tgayush1424
@tgayush1424 Месяц назад
yes it will be 3
@deepakheerakari807
@deepakheerakari807 2 года назад
Thank you so much for such a great explanation 🙂🙂
@hex-tech4171
@hex-tech4171 6 месяцев назад
thanks for very descriptive explaination
@codingkart245
@codingkart245 Год назад
I love your explanation, really helpful!!
@shubhagarwal7770
@shubhagarwal7770 Год назад
very understanding solution thanks...
@samyakjain7422
@samyakjain7422 2 года назад
thanks for these detailed editorials
@supreetsingh3502
@supreetsingh3502 9 месяцев назад
thanks didi for such a nice editorial on this problem
@avneetchugh
@avneetchugh Год назад
Thank you for the video, it is very helpful!
@rishurana9655
@rishurana9655 2 года назад
your teaching skills are amazing
@Anonymous_Coder
@Anonymous_Coder Год назад
Amazing explanation ..!
@jayanthsriram9320
@jayanthsriram9320 2 года назад
Very Nice Explaination, Loved it!
@aniketkadale5960
@aniketkadale5960 Год назад
Amazing Explaination !❤🌟
@komalkrishna7836
@komalkrishna7836 Год назад
nice explanation
@avneetchugh
@avneetchugh Год назад
You mentioned that a heap is a complete binary tree. A binary tree takes n log n to create while a heap takes n. If a heap took n log n then we would have no benefit of using the heap in this situation. Does that sound reasonable?
@Anonymous_Coder
@Anonymous_Coder Год назад
Adding value into a heap takes O(logN) time , where N is no . elements already present int the current heap.
@animeshbarole
@animeshbarole Год назад
Thanq So much
@AmarjeetKumar-to9ub
@AmarjeetKumar-to9ub 2 года назад
Thank You :)
@aniketkadale3937
@aniketkadale3937 Месяц назад
Can someone explain me the n - m == 2 || n - m == -2 part?
@rrichard8719
@rrichard8719 2 года назад
Aptitude drive is urs or some youtubers? Send the link or name of youtuber
@MindsetMotivation75
@MindsetMotivation75 2 года назад
What is your system Ram ?
@gokulnath589
@gokulnath589 Год назад
the way of your teaching and you very nice and beauty girlll
@jayasatwik1046
@jayasatwik1046 Год назад
class MedianFinder { public: MedianFinder() { } priority_queuemaxheap; priority_queueminheap; void addNum(int num) { if(maxheap.empty()&&minheap.empty()) maxheap.push(num); else{ if(num>maxheap.top()) minheap.push(num); else maxheap.push(num); } int m=maxheap.size(); int n=maxheap.size(); if(m-n==2||m-n==-2){ if(m>n){ int k=maxheap.top(); maxheap.pop(); minheap.push(k); }else{ int k=minheap.top(); minheap.pop(); maxheap.push(k); } } } double findMedian() { int m=maxheap.size(); int n=maxheap.size(); if((m+n)%2==0) return ((double)maxheap.top()+(double)minheap.top())/2; if(m>n) return maxheap.top(); else return minheap.top(); } }; /** * Your MedianFinder object will be instantiated and called as such: * MedianFinder* obj = new MedianFinder(); * obj->addNum(num); * double param_2 = obj->findMedian(); */ please tell me what is wrong in the above code..
@shriyanshjain4444
@shriyanshjain4444 Год назад
Hey i have the same doubt it's giving runtime error By the way while dividing you should divide by 2.0 instead of 2 Can you please tell me if you have resolved the error?
@Auto_Enthusiast
@Auto_Enthusiast Год назад
i am also facing the same issue , int 3rd test case
Далее
Find Median from Data Stream
29:28
Просмотров 55 тыс.
Leetcode Decode Ways || Intuition + Code + Explanation
31:49
Median of 2 sorted arrays
26:38
Просмотров 6 тыс.