Median of stream of running integers | Heaps, Priority Queues Application | Explanation from Basics

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ก.ย. 2024

ความคิดเห็น • 324

  • @amanaziz2785
    @amanaziz2785 3 ปีที่แล้ว +62

    Thank you for giving such a simple explanation. I am a pre final year engineering student and I watched this video a few weeks earlier. The same question was asked to me in my technical interview yesterday when I sat for internship and the interviewer was really impressed with the way I explained it. I secured an internship there and this question has a big role in it. Thank you so much. Before watching this video I had no idea how to do this but your explanation made it really simple. I have watched your other videos as well. The way you explain is really amazing. Thanks again :)

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +4

      This made my day!
      Thank you so Aman 🙂 Congratulations and all the best for your internship 😇😇

    • @amanaziz2785
      @amanaziz2785 3 ปีที่แล้ว +1

      @@KeertiPurswani Thanks :)

    • @sameer1571
      @sameer1571 3 ปีที่แล้ว +6

      I do not know how to say it but 1 week back I saw this video i just understood it and even did not write the code yesterday this question was asked in Walmart interview and i just explained it and got selected too..thanks to you di :) :)

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +4

      Congratulations Sameer. So happy for you!!❤️
      And thank you for sharing with me 😇

  • @AbhiNandan-ct9or
    @AbhiNandan-ct9or 2 ปีที่แล้ว +4

    This is by far the most intuitive and understandable solution on internet. The typical solution provided by leetcode is confusing and difficult to follow. Thanks for this video and keep up the good work!

  • @nagsenwaghmare5115
    @nagsenwaghmare5115 3 ปีที่แล้ว +9

    I liked the way you are increasing confidence of those viewers who are unable to understand by using punch lines such as : "if it is still not clear, it is ok we will go through example and see!" That's something cool mam Thanks for such Amazing video 😀😀

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +3

      I have struggled with these questions myself in the past. I know how overwhelming it can be. So I tru my best to keep it simple and keep viewers motivated ❤️

    • @shaheenrafiq5974
      @shaheenrafiq5974 3 ปีที่แล้ว

      @@KeertiPurswani You're too kind :') thank you so much for the SUPER smooth explanation

  • @deepapandey849
    @deepapandey849 2 ปีที่แล้ว +2

    Loved it! Never seen someone explaining a hard level question so calmly and intuitively ! Thank you keerti 👏👏👏

  • @sooyashjaju4208
    @sooyashjaju4208 2 ปีที่แล้ว

    Itna preshan hone ke bad abh is video ko dekhne ke bad code smjh aya !
    Thank you For such a clear , calm and Intuitive Solution.

  • @vulturebeast
    @vulturebeast 4 ปีที่แล้ว +11

    This question was Best explained here 👍🏼

  • @killeraloo3247
    @killeraloo3247 7 หลายเดือนก่อน

    Kya hi explain kiya hai, maja aa gya. Sab samajh aa gya. 🧡 from remote.

  • @chaitanya_p1
    @chaitanya_p1 ปีที่แล้ว

    Best explanation for this problem by dry running it, in the whole TH-cam.

  • @sagarkabadi5594
    @sagarkabadi5594 3 ปีที่แล้ว +1

    The best explanation ever. I was stuck in this question from past two days and then I watched ur video..omg I solved it with in an half an hour 🔥
    Though some bugs were there in my code before 😂😂😂

  • @satyarajraghav661
    @satyarajraghav661 11 หลายเดือนก่อน

    👍great explanation! She and Jenny are the best indian women youtubers who are expert in DSA.✌

  • @Kartik-o1
    @Kartik-o1 ปีที่แล้ว

    Best and fluid explanation. Even in the first 5 minutes got the intuition and the next explanations are cherry on top. Thanks again.

  • @harshaggarwal1967
    @harshaggarwal1967 ปีที่แล้ว

    This is the best explanation of this question i've got so far..thanks!

  • @ritikmishra3643
    @ritikmishra3643 3 ปีที่แล้ว

    For people like me, the core concept here is to use max heap to store the left half (of sorted elements) and min-heap to store the right part (of sorted elements). So as to get the maximum of left part and minimum of right part (because we only need the middle section if we arrange elements in sorted order).
    8:14 onwards, Keerti explains why we need to do that...
    Precise content, kudos to you!

  • @sigma9089
    @sigma9089 4 ปีที่แล้ว +3

    Your explanation was awesome.
    This is the C++ implementation.
    (I have used integer priority queue, but we can also use double.)
    #include
    using namespace std;
    int main() {
    //code
    int n;
    cin>>n;
    priority_queue maxheap; //Lower Half
    priority_queue minheap; //Upper Half
    int a;
    while(n--)
    {
    cin>>a;
    if(maxheap.empty() || maxheap.top()>a)
    {
    maxheap.push(a);
    }
    else minheap.push(a);

    if(maxheap.size()>minheap.size()+1)
    {
    minheap.push(maxheap.top());
    maxheap.pop();
    }
    else if(minheap.size()>maxheap.size()+1)
    {
    maxheap.push(minheap.top());
    minheap.pop();
    }
    if(minheap.size()==maxheap.size()) cout

    • @KeertiPurswani
      @KeertiPurswani  4 ปีที่แล้ว +1

      Great job @Akash. Thanks for sharing 😊😊

    • @AK-yb4ml
      @AK-yb4ml 4 ปีที่แล้ว

      Is " a " here is running number or stream here.

    • @AK-yb4ml
      @AK-yb4ml 4 ปีที่แล้ว

      If input is vector of Integers then would it give correct answer.

    • @sigma9089
      @sigma9089 4 ปีที่แล้ว

      @@AK-yb4ml Yes, if input is vector you can modify the program accordingly to take input as a stream.
      If input is a vector you can run a loop and instead of using variable a you will write v[i] if v is your vector.

  • @shauryagupta3954
    @shauryagupta3954 2 ปีที่แล้ว

    Very smoothly explained. Thanks Ma'am.

  • @vishnusingh4118
    @vishnusingh4118 4 ปีที่แล้ว +5

    Lovely explanation Keerti. Great job! One suggestion though, you seem to be not caring about the code implementation (from what you said and from your past videos). That is understandable as when we reach an advanced level, an algo is all we need and a proficient coder will have no problem converting the algo to code even while they are drunk. But isn't your channel for beginners ? I can tell you code is everything for a beginner! What does one do with the algo if they can't implement it ? It would have taken you a few mins and people would have got clarity to how to convert all this "English" into actual working code. "priority_queue mypq" - Oh! that's how u implement it in code". Means the world! I guess it's a lot more hardwork ? But to be honest, most books, videos do exactly what you're doing. They just explain the algo. But if there's a beginner listening to this (which I assume is your target audience, since you break down the problem so nicely into understandable chunks) therefore isn't it obvious that they will not know how to implement a pqueue in C++ (or Java etc) ? When I was learning all this, the biggest pain point was that everyone would talk about the algo, but no one would show the code! If you show, the actual code - half the concept is clear from there itself! It is ek teer do shikaar - you can do a dry run of the algo through the code as well, and the viewer gets to see the implementation. Otherwise, I feel it is more like just hand waving in the air (again - only for beginners!). I understand looking up code is just a Google search away, but then so is looking up the algo, isn't it ? :p.
    Please don't take it as criticism. It is only a suggestion. I think you're doing a fantastic job! You don't have to listen to me. Thanks for another lovely vid again! :)

    • @KeertiPurswani
      @KeertiPurswani  4 ปีที่แล้ว +6

      Hi Vishnu, thank you so much for your comment. Such discussions are always welcome :)
      As you said, the channel is for beginners and that is the reason I don't want to make any beginner feel that they should be restricted to one particular language. Suppose I told the syntax in C++ or java, and someone who codes in python asks why I didn't cover his language - what will I tell him/her?
      Infact, in most of the companies, language doesn't matter, as long as you are able to write the algorithm which I did.
      Also, yes both algorithm and syntax are a Google away but syntax is about copy pasting (or remembering) but algorithm is about understanding the concept behind it.
      I want to encourage people to go behind the logic. The syntax is something that you can just copy paste.
      And about Dry run, I did it for the code I wrote yeah? The only thing I didn't write was how to declare the priority queue 😅
      I hope I make sense?

    • @nagavijaykumarprathi8531
      @nagavijaykumarprathi8531 4 ปีที่แล้ว +1

      @@KeertiPurswani i like your way of explanation. By dividing into chunks.
      I agree to the point (not giving code).
      You make me clear in algorithm. Converting into code is jst syntax thing.
      P.S : we have to do some hardwork to learn something.
      P.P.S : if possible create telegram channel. So we can discuss there.
      ThankYou

    • @vanshsehgal9475
      @vanshsehgal9475 2 ปีที่แล้ว

      @@KeertiPurswani I loved the way you handled the comment. Very camly!!

  • @amolekande6828
    @amolekande6828 11 หลายเดือนก่อน

    Thank you Keerti for the amazing explanation. this is now imprinted in my mind.

  • @pammugaadu
    @pammugaadu 2 ปีที่แล้ว

    Thank you for the great explanation.
    Java code with stream of integers generation and finding the median is given below:
    import java.util.PriorityQueue;
    import java.util.Random;
    import java.util.stream.Collectors;
    import java.util.stream.IntStream;
    public class RunningMedian {
    public static void main(String args[]) {
    RunningMedianUtility runningMedianUtility = new RunningMedianUtility();
    // stream of integers
    IntStream.generate(() -> new Random().nextInt(50)).limit(new Random().nextInt(50)).forEach(
    runningMedianUtility::add
    );
    //Display values of min and max heap
    runningMedianUtility.display();
    System.out.println(runningMedianUtility.getMedian());
    }
    }
    class RunningMedianUtility {
    private final PriorityQueue maxHeap;
    private final PriorityQueue minHeap;
    public RunningMedianUtility() {
    this.maxHeap = new PriorityQueue((o1, o2) -> {
    return -1 * o1.compareTo(o2);
    });
    this.minHeap = new PriorityQueue();
    }
    public void add(Integer value) {
    if (maxHeap.isEmpty() || maxHeap.peek() > value) {
    maxHeap.add(value);
    } else {
    minHeap.add(value);
    }
    // Re-balancing
    if (maxHeap.size() > minHeap.size() + 1) {
    minHeap.add(maxHeap.poll());
    } else if (minHeap.size() > maxHeap.size() + 1) {
    maxHeap.add(minHeap.poll());
    }
    }
    public double getMedian() {
    if (maxHeap.size() > minHeap.size()) {
    return maxHeap.peek();
    } else if (minHeap.size() > maxHeap.size()) {
    return minHeap.peek();
    } else {
    return (minHeap.peek() + maxHeap.peek()) / 2.0;
    }
    }
    public void display() {
    System.out.println(maxHeap.stream().map(o -> String.valueOf(o)).collect(Collectors.joining(",")));
    System.out.println(minHeap.stream().map(o -> String.valueOf(o)).collect(Collectors.joining(",")));
    }
    }

  • @olagunjujoba3889
    @olagunjujoba3889 ปีที่แล้ว

    Keerti your lecture is so beautiful. Soft and clear explanation. You combined two of the best things of this world, beauty and brilliance. So i rate you as b++.

  • @kautukraj
    @kautukraj 3 ปีที่แล้ว +2

    Crystal clear explanation for a supposedly hard question!

  • @azeemsiddiqui6714
    @azeemsiddiqui6714 3 ปีที่แล้ว

    Very Simple step by step explanation

  • @aakashyadav6228
    @aakashyadav6228 3 ปีที่แล้ว +3

    Loving the success stories in the comments. You are definitely a great teacher Di !

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +1

      Thank you Aakash, means so much ❤️
      Success stories are my fav too😇😇

  • @sriharshaangadi7693
    @sriharshaangadi7693 3 ปีที่แล้ว +1

    Calm and detailed explanation. Appreciate you for a quick recap every few minutes. Keep up the good work.

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +1

      Glad you liked it! Thank you 😇

  • @sujoyseal195
    @sujoyseal195 ปีที่แล้ว

    Your explanation skills are top notch. A calm river slowly flowing out to the sea . Same rythm smooth flow

  • @yashjain1011
    @yashjain1011 2 ปีที่แล้ว

    You explain so calmly and nicely. Absolutely what I required. Thank u so much for making these videos. Even if some other videos are shorter, I would still prefer yours.

  • @shaiksayyadbabasharief8502
    @shaiksayyadbabasharief8502 2 ปีที่แล้ว

    Great explanation Keerti, most of your content is very clear, concise and can be understood even by newbie's. You are the true inspiration, motivator and very good mentor to most techie's

  • @utkarshjain8024
    @utkarshjain8024 3 ปีที่แล้ว

    One of the most fluid explanations of a problem that I have come across!

  • @brendensong8000
    @brendensong8000 2 ปีที่แล้ว

    Excellent, excellent, excellent explanation! Thank you for sharing this! this really helps with a hackerrank problem set

  • @abhishekhorton79
    @abhishekhorton79 3 ปีที่แล้ว +1

    thanks for sharing such gem on youtube I must say this you made this hard level problem like an easy solution
    NOTE : in c++ you've max priority queue by default so to make a min priority queue just multiply -1 with the element while pushing or popping from a queue
    once again thank you so much dii ;)

  • @parikshitsharma3393
    @parikshitsharma3393 3 ปีที่แล้ว

    Thank You very much I watched several videos but couldn't understand but after watching this video I was able to fully understand it.

  • @sivaraju6795
    @sivaraju6795 3 ปีที่แล้ว +1

    Great explanation, explained in very simple terms, can be understood for the very beginners in the programming.

  • @kartiksaini5619
    @kartiksaini5619 3 ปีที่แล้ว

    This is the best and the smallest possible code available 🔥🔥 and yeh best explantion thank u Ma'am

  • @rishavsinghmehta52
    @rishavsinghmehta52 4 ปีที่แล้ว +2

    Great teaching sense and awesome explanation.... 🔥🔥🔥🔥

  • @aman_sahu
    @aman_sahu 3 ปีที่แล้ว +1

    Really nice and simple explanation over youtube!!!...

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +1

      Thanks Aman 😇 Hope you like rest of the videos as well 😇

    • @aman_sahu
      @aman_sahu 3 ปีที่แล้ว

      @@KeertiPurswani Yes...😍

  • @varunr3055
    @varunr3055 2 ปีที่แล้ว

    Amazing explanation. God's work!

  • @anubhavbhutani8512
    @anubhavbhutani8512 4 หลายเดือนก่อน

    what an explanation 😲 Fantastic !!

  • @sushmitagoswami2033
    @sushmitagoswami2033 ปีที่แล้ว

    Keerti please keep going and you will be one of the best teachers in this field very soon.

  • @lalitsharma6132
    @lalitsharma6132 ปีที่แล้ว

    GOD LEVEL EXPLANATION

  • @ratneshgupta2770
    @ratneshgupta2770 2 ปีที่แล้ว

    Mam hats off to your explanation only listening to the explanation made the code crystal clear thank you for this amazing content

  • @UECDishaKhattri
    @UECDishaKhattri 2 ปีที่แล้ว

    The best explaination Keerti , it makes the question difficult to forget !

  • @abhinavverma4111
    @abhinavverma4111 3 ปีที่แล้ว

    Very nice explanation. Could not have cracked this approach in live interview before.

  • @sandeepm2723
    @sandeepm2723 4 ปีที่แล้ว +1

    Hard problem + best explanations = problem become a cakewalk.

  • @sadhiyashiraj6990
    @sadhiyashiraj6990 4 ปีที่แล้ว +6

    This is great Keerti, proud of your hardwork!! 😍😍

    • @KeertiPurswani
      @KeertiPurswani  4 ปีที่แล้ว +1

      Thank you so much ❤️

    • @audioplatform6299
      @audioplatform6299 3 ปีที่แล้ว

      why you proud of her work? just curious

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว

      She is my friend 😇

    • @audioplatform6299
      @audioplatform6299 3 ปีที่แล้ว

      @@KeertiPurswani got it!.. Very good channel for learning.. good luck!!

  • @sagarlandge3271
    @sagarlandge3271 3 ปีที่แล้ว

    Wonderfully explained, not gonna forget this for the rest of my life

  • @arlenejohn4843
    @arlenejohn4843 4 ปีที่แล้ว +1

    This is a very clear explanation. Good job Keerti! So proud!!!

  • @shivambansal3560
    @shivambansal3560 4 ปีที่แล้ว +2

    The Best Explanation Ever !!!

  • @Meethu69
    @Meethu69 3 ปีที่แล้ว

    Thanks a ton didi.Providing such amazing content for free

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +1

      Blessed to be able to do that 😇😇

  • @danishirfan9317
    @danishirfan9317 3 ปีที่แล้ว

    I was practicing this question on geeksforgeeks but couldn't understand the explanation given there. So after searching for a video on youtube, I found yours and completely understood the logic.
    Thank you for making this video! I've subscribed to your channel 😊

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +1

      Thank you so much Danish. Means a lot 😇

    • @danishirfan9317
      @danishirfan9317 3 ปีที่แล้ว

      @@KeertiPurswani You're welcome 😊

    • @mayankgoyal8064
      @mayankgoyal8064 3 ปีที่แล้ว

      @@KeertiPurswani same happened with me...Thanks, it really helped me a lot :)

  • @rohitraj5832
    @rohitraj5832 3 ปีที่แล้ว

    ohhh my god!! , what a clear understanding I got after watching this video, thanku so much mam. loved it

  • @arijitdey8419
    @arijitdey8419 2 ปีที่แล้ว

    superb explanation..thanks a lot mam for the video

  • @ashwinnema06
    @ashwinnema06 2 ปีที่แล้ว

    Nice explanation Keerti. I understood your approach and solved this question on leetcode watching first 10 minutes of video

  • @tanmaymalhotra4450
    @tanmaymalhotra4450 3 ปีที่แล้ว

    No doubt this is a difficult question but, the way you explained it made this question really easy. Thank you Ma'am .

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +1

      Thank you so much Tanmay 😇🙏🏻

  • @prateekpandey4781
    @prateekpandey4781 3 ปีที่แล้ว

    Just one word - "Excellent"!

  • @dhruvpurwar6642
    @dhruvpurwar6642 2 ปีที่แล้ว

    Best explanation ever!!!

  • @shwetabhagat8920
    @shwetabhagat8920 ปีที่แล้ว

    you explained the question soo well that now it feels like an easy problem 😄

  • @gollapudibhargav2323
    @gollapudibhargav2323 3 ปีที่แล้ว +1

    Good work! Just for the sake of completeness, I want to add some additional insights, please feel free to correct me if I got anything wrong.
    The main advantage of this approach is that it improves the time complexity for retrieving the median for a read heavy system in the presence of stream data. The time to retrieve max/min from priority queue is constant. Thus, the time to calculate the median from a stream of data is reduced to constant time. Pause to think about it, this is a big deal!
    Hadn't we use this arrangement for storing the numbers, the alternatives are really, saving the numbers in a sorted fashion in some form of set or vector. Vector is not the right choice since the input is large and we might keep resizing the vector to fit elements. In the worst case the vector keeps growing and bottlenecks the system, alternately we could chunk the array and put it in memory that has its own drawback (finding median in K sorted arrays :()
    The time complexity of retrieving median from a sorted structure is log N (if the structure has say N elements) and in a read heavy system, if I keep making calls to compute median a large number of time (say K) the overall complexity to calculate the median increases to KlogN or NlogN!
    The approach that Keerti pointed out reduces it constant time!
    If you have made this far, thankyou! Brownie insight...we can get the median by not really saving all the elements. We can think of equal fractions of elements we can eleminate from the heap and still get median in constant time.
    Illustration (for a sorted array size > 4)
    a1 , a2 , a3 .... ak, ak+1...aN-3, aN-2, aN-1
    Can you convince yourself that the median won't change if I knock of (a1 and aN-1) and inductively if I knock off (a1, a2, aN-2 and aN-1)??
    Food for thought? What else will you gain by this approach for a system that only need median and not the data really?
    Once again! Good job Keerti, great content, just wanted to add some more insights for completeness.

  • @spk9434
    @spk9434 3 ปีที่แล้ว +1

    hey good that you mentioned insertion sort. We never think of quadratic sorts while giving out a brute force approach. I think its a good way to start at an interview.

  • @shubhamchandra9258
    @shubhamchandra9258 2 ปีที่แล้ว

    This question is quite simple to understand and to implement. If you really want to show your algorithms skills you should do a video on median of two sorted arrays in log(n) time. I'm quite sure you wouldn't be able to.

    • @KeertiPurswani
      @KeertiPurswani  2 ปีที่แล้ว

      There’s already a video on that, and don’t be so sure because everyone who watched the video can do it for sure ✌️

  • @lakshminathreddyalamuru2834
    @lakshminathreddyalamuru2834 2 ปีที่แล้ว

    Thanks you for giving such a simple explanation

  • @mdizrail792
    @mdizrail792 4 ปีที่แล้ว +1

    Mam You are doing great work . please consider more hard problems from Leetcode .

  • @akhilsharma1778
    @akhilsharma1778 3 ปีที่แล้ว

    I could not figure out when to insert in min-heap and when to insert in max-heap(which is the most important part). Thanks for the explanation. OP :P

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว

      Please watch the video once more? I am sure you will understand!

  • @Deepak-gj4ni
    @Deepak-gj4ni 3 ปีที่แล้ว

    Please make more videos on such questions. We need more teachers like you..

  • @narsi1143
    @narsi1143 4 วันที่ผ่านมา

    excellent Explanation
    thank you

  • @sundarrajagopal4639
    @sundarrajagopal4639 2 ปีที่แล้ว

    Thanks Keerti. Keep your good work !

  • @capy_can_code
    @capy_can_code 4 ปีที่แล้ว

    Awesome, the logic can be further simplified, if you push to maxheap and then poll the top value from maxheap and push it to minheap. Maintain the difference between size to max one.

    • @KeertiPurswani
      @KeertiPurswani  4 ปีที่แล้ว

      That's exactly what I am doing 😅 what is the simplification suggested?😅

  • @SumitKumar-fn3gj
    @SumitKumar-fn3gj 2 ปีที่แล้ว

    thank you for such wonderful explanation

  • @allwell8570
    @allwell8570 3 ปีที่แล้ว

    Your explanations are easy to understand. Keep doing great work.

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +1

      Thank you Ramesh, means so much❤️

  • @ishanikasingh9321
    @ishanikasingh9321 3 ปีที่แล้ว

    such shortcode for this hard level marked question was just unimaginable! looking on for more of your videos! thank you, saviour! :p

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +1

      Haha yeah, it’s all about the concept!
      Thank you so much for all the love and support❤️

  • @prasantharavindramesh1078
    @prasantharavindramesh1078 3 ปีที่แล้ว

    Thank you for the awesome content always.I finally understood this hard problem.Best explanation ever

  • @songs-pu9bq
    @songs-pu9bq 2 ปีที่แล้ว

    Loved the way you made it so simple

  • @albinthomas9737
    @albinthomas9737 2 ปีที่แล้ว +1

    I just Want to know what's the difference if we use a single set/heap . What will be the reduce in time complexity by using 2 heap

  • @aryanagarwal2071
    @aryanagarwal2071 3 ปีที่แล้ว

    Glad I found your channel !💯😍

  • @devprakash5320
    @devprakash5320 4 ปีที่แล้ว

    she explained it beautifully . great video .

  • @kollivenkatamadhukar5059
    @kollivenkatamadhukar5059 3 ปีที่แล้ว

    Time Complexity is 3.logn(At worst case we perform 2 push and 1 pop) and not nlogn please correct me if I am wrong, We should not consider n as the size of the array as it is a running stream.

  • @nareshnagpal4551
    @nareshnagpal4551 3 ปีที่แล้ว

    Wonderful explanation for Heaps. Hard to find such simple explanation anywhere else.

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว

      Thank you so much Naresh. Means a lot. Hope you like rest of the videos as well 😇😇

    • @nareshnagpal4551
      @nareshnagpal4551 3 ปีที่แล้ว

      @@KeertiPurswani yes I have started watching of them. You have put a lot of effort in making quality content. Great work and thanks for your contributions. Its really helpful.

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว

      Thank you 🥺🥺😇😇

  • @navneetarora5150
    @navneetarora5150 2 ปีที่แล้ว

    Thanks for the explanation The solution is overall good but i personally could not wrap my head about how i will explain this approach to the interviewer as when you explained how we are inserting the number in our heaps as that is difficult to come up with on our own instead i think we should proceed by taking different cases and add number by comparing them to the current median and maintaining the size difference.

  • @shubhamkumar-gw4vb
    @shubhamkumar-gw4vb 3 ปีที่แล้ว

    well done keerti, it was really explained well....kudos!!!!!!

  • @sameekshabhatia5443
    @sameekshabhatia5443 2 ปีที่แล้ว

    Thank you so much ,it was really very helpful .

  • @abhishekpopli5619
    @abhishekpopli5619 4 ปีที่แล้ว +3

    The explanation and dry run was awesome. Kudos to your great efforts!

  • @neelakshsharma4936
    @neelakshsharma4936 4 ปีที่แล้ว

    Amazing explanation of the solution. Please make more and more videos like this. Thank you.

    • @KeertiPurswani
      @KeertiPurswani  4 ปีที่แล้ว +1

      Thank you. Many videos coming up 😊

  • @akshayyadav898
    @akshayyadav898 3 ปีที่แล้ว

    Really nice explanation, thanks

  • @hunternineone4168
    @hunternineone4168 3 ปีที่แล้ว

    Best explanation ever!

  • @aniketkankekar410
    @aniketkankekar410 3 ปีที่แล้ว +1

    best explanation.....

  • @techenthusiast3966
    @techenthusiast3966 3 ปีที่แล้ว

    Best explanation of the question and solution.

  • @Anonymous-pj2mv
    @Anonymous-pj2mv 3 ปีที่แล้ว

    Unbeatable explanation .
    Really great work di .

  • @dhairyashiil
    @dhairyashiil 3 ปีที่แล้ว

    Thank you Di..
    You are amazing!

  • @tusharkumar3277
    @tusharkumar3277 4 ปีที่แล้ว +1

    Thank you maam,u so nicely explained the concept🙏

  • @TaniyaMadaan
    @TaniyaMadaan 4 ปีที่แล้ว +1

    Really great explanation. Loved it

  • @deviramkondaveti2415
    @deviramkondaveti2415 4 ปีที่แล้ว

    Good Explanation.Thank you for your explanation

  • @shreyankshrestha9274
    @shreyankshrestha9274 3 ปีที่แล้ว

    Best Explanation 💖

  • @SHIVANSH257
    @SHIVANSH257 3 ปีที่แล้ว

    Why can't we use array for the same thing, like make a hash map and do the same operations on array, time complexity will reduce even more

  • @mohanbhati9595
    @mohanbhati9595 4 ปีที่แล้ว +2

    Best one explanation.

  • @sackshamsharma2829
    @sackshamsharma2829 4 ปีที่แล้ว

    this problem doesn't look hard enough after your explanation, loved the explanation please make more videos.

    • @KeertiPurswani
      @KeertiPurswani  4 ปีที่แล้ว

      Thank you so much. Many videos coming up 😇😇

  • @aniketmasram6500
    @aniketmasram6500 3 ปีที่แล้ว

    U made it soo easy to understand 🔥🔥🙏🏻🙏🏻🎉🎉

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว +1

      Yaaay, thank you ❤️❤️ hope you like rest of the videos as well 😇😇

  • @prernasingh5439
    @prernasingh5439 3 ปีที่แล้ว

    such a clear explanation ! Thank you so much Di

    • @KeertiPurswani
      @KeertiPurswani  3 ปีที่แล้ว

      Thanks Prerna. So glad you like it!
      Please do share the channel with your friends and help it get better reach 😇🙏

  • @surajshende5719
    @surajshende5719 3 ปีที่แล้ว +1

    Great explaination. I am watching your video for the first and really liked it. Keep doing the same.

  • @vivekojha4807
    @vivekojha4807 4 ปีที่แล้ว +1

    Beautiful Explanation. Thanks

  • @tech_non_tech9803
    @tech_non_tech9803 3 ปีที่แล้ว

    keerti maam u explains very well , please keep explaining

  • @cakec9
    @cakec9 3 ปีที่แล้ว

    Excellent explanation in the Visualization part.

  • @sayantaniguha8519
    @sayantaniguha8519 ปีที่แล้ว

    In addNum(), why not store all elements into a single maxHeap .
    Then,
    push half of the length of maxHeap no. of elements -from the top - into a minHeap(declared inside the addNum() )
    Is it less efficient in any way ?