Median Priority Queue - Solution | Hashmap and Heap | Data Structure and Algorithms in JAVA

  Рет қаралды 28,244

Pepcoding

Pepcoding

3 жыл бұрын

Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we explain the solution to median priority queue in Hashmap.
For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
#pepcoding #java #programming
Have a look at our result: www.pepcoding.com/placements
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
Join us on Telegram: t.me/joinchat/UVTjJE83a-zFnPB

Пікірлер: 49
@Dizerfullpower
@Dizerfullpower 3 жыл бұрын
Thanks a lot, I was assigned this problem with extremely vague description at school. As soon as you started coding, I got what they really asked me to do!
@stith_pragya
@stith_pragya 2 ай бұрын
Thank You So Much for this wonderful video.....🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@shivamsingh7219
@shivamsingh7219 3 жыл бұрын
Sir,even vale case mein median average of middle two hota hai Isiliye ek condition aur aaygi If(left.size()==right.size()){ return. (left.peek()+right.peek())/2
@shivambhardwaj3273
@shivambhardwaj3273 2 жыл бұрын
Pure Gold! hats off to you sir!
@547julia
@547julia 2 жыл бұрын
Thanks a lot! This seems so simple now and elegant too
@sarthakgiri4596
@sarthakgiri4596 Жыл бұрын
you are elite sir! love from Nepal
@KinnarKansara
@KinnarKansara 3 жыл бұрын
You made it very easy to understand. Great job brother. Keep it up!
@Pepcoding
@Pepcoding 3 жыл бұрын
I am glad you liked it. I also hope that you are watching all the videos till the end and trying to understand the problem. Will you like to write a few words about us here (www.quora.com/What-is-a-good-source-to-learn-data-structures-and-algorithms)
@ankur.singhs2111
@ankur.singhs2111 3 жыл бұрын
Sir many students have just 3 month remaining in placements, so can you make a 3 months step by step roadmap to master DS Algo to crack good companies ? Much much needed sir.
@Pepcoding
@Pepcoding 3 жыл бұрын
The smallest plan i have needs 200 days. kzbin.info/www/bejne/aHrHnaV-rcmfl5Y
@hjklmn9526
@hjklmn9526 Жыл бұрын
Sumeet great explanation. I think when the number of elements in the max_heap (left_heap) and min_heap (right heap) is even, we take average value of the top elements from both heaps to get the median..
@suvamroy6205
@suvamroy6205 2 жыл бұрын
You're nothing less than a god. You're a life-saver.
@Pepcoding
@Pepcoding 2 жыл бұрын
Hope you like the video. For better experience and well organised content sign up on nados.io And for being updated follow us on Instagram instagram.com/pepcoding/
@AmanKumar-bh6bc
@AmanKumar-bh6bc 2 жыл бұрын
great explanation.
@siddhantchowdhary2230
@siddhantchowdhary2230 Жыл бұрын
great video sir,thanks a lot sir
@AbhinandanSharmaiisc2017
@AbhinandanSharmaiisc2017 3 жыл бұрын
This is pure gold stuff
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! I am glad you liked it. I hope that you are watching videos till the end. If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@adarshsharmanit356
@adarshsharmanit356 3 жыл бұрын
Respect++ NIce Explanation SIr !!
@Pepcoding
@Pepcoding 3 жыл бұрын
Glad to know that you liked the content and thank you for appreciating. The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos. So, keep motivating, keep learning and keep loving Pepcoding😊
@rishabhgoyal2835
@rishabhgoyal2835 3 жыл бұрын
amazing , what abt time and space complexity
@rishabhgoyal9623
@rishabhgoyal9623 3 жыл бұрын
gazab explanation❤️
@Pepcoding
@Pepcoding 3 жыл бұрын
I am glad
@rachelross9275
@rachelross9275 3 жыл бұрын
Excellent!😍
@Pepcoding
@Pepcoding 3 жыл бұрын
Thank you! Cheers!
@khemendrabhardwaj2552
@khemendrabhardwaj2552 Жыл бұрын
I think implementation with multiset in c++ would be really simple especially the deletion part
@architsharma4331
@architsharma4331 2 жыл бұрын
Sir I did this problem the same way we did in Queue to Stack Adapter(add efficient) question and it passed all the test cases as well
@Pepcoding
@Pepcoding 2 жыл бұрын
Great 👍
@LegitGamer2345
@LegitGamer2345 3 жыл бұрын
we are finding median here in increasing data ?
@fashionvella730
@fashionvella730 2 жыл бұрын
do this on my own i am very happy to sove hard question on my own
@prahladrana6391
@prahladrana6391 3 жыл бұрын
sir what if the element to be added lies between both the current medians.. where it has to be inserted? like the moment where the medians were 20 and 30.. and the next no. coming up was to be 26 then where should it go?
@Pepcoding
@Pepcoding 3 жыл бұрын
chote wali mei. chahe usme already data jyada ho. balance ho jaega. jaise he do ka gap banta hai to wo balance karta hai
@prahladrana6391
@prahladrana6391 3 жыл бұрын
@@Pepcoding ok sir
@kagoel71
@kagoel71 3 жыл бұрын
Sir does this question belong to the catgory jisse ratna hain ie memory based or this belongs to coding aptitude category?As thinking of this solution that you prescribed was pretty tough.
@Pepcoding
@Pepcoding 3 жыл бұрын
Memory based
@codingwithanonymous890
@codingwithanonymous890 Жыл бұрын
yes dude this solution really requires so much thought process...to come up with this solution in short span of interview
@shubhamsood1406
@shubhamsood1406 3 жыл бұрын
Atisundar ^_^
@Pepcoding
@Pepcoding 3 жыл бұрын
:-)
@rajshah9129
@rajshah9129 6 ай бұрын
How to come up that we require 2 priority queue one of min and one of max pls give intuition also
@iankush18
@iankush18 3 жыл бұрын
Bhai jab left m 3 hai or right m 3 hai toh dono mean lete hai naa
@NiranjanKumar-cb8si
@NiranjanKumar-cb8si 3 жыл бұрын
this.size() == right.size()+left.size() ????? how is it working (this.size() ) ?
@Pepcoding
@Pepcoding 3 жыл бұрын
Beta, kaunse time pe? video mei time btaie.
@harshitkaushik4144
@harshitkaushik4144 3 жыл бұрын
sir jo aapne main function banaya hua bhai vo samjh nahi aata ki khud se apne tareke se kaise banaye same case linked list , stacks and queue me bhi hua tha ab ye bas aage khichta ja raha hai sir jaise aap bufferreder , quit , exit , and so on ka use karte ho vo samjh nahi aata ki agar use scanner aur apne tareke se banaye to kaise banaye ya fir interview me bhi aise hi aayega ki hume sirf ye 4 funtion hi banane honge
@Pepcoding
@Pepcoding 3 жыл бұрын
Beta it's just the syntax, practice k sath apne aap yaad he ho jayega vo to
@harshitkaushik4144
@harshitkaushik4144 3 жыл бұрын
@@jonusbrothers2067 First they laugh at you then they set u as an example M also waiting for that moment brother Which is gonna happen soon
@sahilnegi2789
@sahilnegi2789 3 жыл бұрын
Sir Iam not able to think this logic ..
@1qwertyuiop1000
@1qwertyuiop1000 2 жыл бұрын
Hindi thareyathu poda...
@sumitshokeen4065
@sumitshokeen4065 2 жыл бұрын
Hi Urkriskhnan, this same content is also available in English on nados
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 8 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 8 МЛН
ROCK PAPER SCISSOR! (55 MLN SUBS!) feat @PANDAGIRLOFFICIAL #shorts
00:31
SLIDING WINDOW MEDIAN| LEETCODE 480 | PYTHON TWO-HEAP SOLUTION
30:07
Cracking FAANG
Рет қаралды 3,5 М.
Leetcode 295. Find Median from Data Stream Intuition + Code C++ Example
27:59
Data Structures: Solve 'Find the Running Median' Using Heaps
9:53
2.6.3 Heap - Heap Sort - Heapify - Priority Queues
51:08
Abdul Bari
Рет қаралды 2 МЛН
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 8 МЛН