Median Priority Queue - Solution | Hashmap and Heap | Data Structure and Algorithms in JAVA
Vložit
- čas přidán 1. 08. 2020
- 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
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!
Thank You So Much for this wonderful video.....🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
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
Pure Gold!
hats off to you sir!
Thanks a lot! This seems so simple now and elegant too
you are elite sir! love from Nepal
great video sir,thanks a lot sir
great explanation.
You made it very easy to understand. Great job brother. Keep it up!
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)
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.
The smallest plan i have needs 200 days.
czcams.com/video/2IdlrHxdla4/video.html
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..
This is pure gold stuff
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 )
You're nothing less than a god. You're a life-saver.
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/
Respect++
NIce Explanation SIr !!
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😊
Excellent!😍
Thank you! Cheers!
gazab explanation❤️
I am glad
amazing , what abt time and space complexity
we are finding median here in increasing data ?
do this on my own i am very happy to sove hard question on my own
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
Great 👍
How to come up that we require 2 priority queue one of min and one of max pls give intuition also
I think implementation with multiset in c++
would be really simple
especially the deletion part
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?
chote wali mei. chahe usme already data jyada ho. balance ho jaega. jaise he do ka gap banta hai to wo balance karta hai
@@Pepcoding ok sir
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.
Memory based
yes dude this solution really requires so much thought process...to come up with this solution in short span of interview
Bhai jab left m 3 hai or right m 3 hai toh dono mean lete hai naa
Atisundar ^_^
:-)
this.size() == right.size()+left.size() ????? how is it working (this.size() ) ?
Beta, kaunse time pe? video mei time btaie.
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
Beta it's just the syntax, practice k sath apne aap yaad he ho jayega vo to
@@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
Sir Iam not able to think this logic ..
Hindi thareyathu poda...
Hi Urkriskhnan, this same content is also available in English on nados