Bro dropped the best explanation for priority Queue and think we won't notice.
@subhammahanta34332 жыл бұрын
We need more teachers like you sir...!!(Who will never let the students get bored)......agar ese teacher mil gaye to India a future bright h
@Pepcoding2 жыл бұрын
Keep learning. And for better experience, visit nados.io, where you will get well curated content and career opportunities.
@a.techsys93892 жыл бұрын
@subham right brother.
@sanatasneem26742 жыл бұрын
This is some whole other level 😲😲😲😲 Kabhi socha bhi nahi hoga ki ayese bhi koi samjha sakta hai!
@itachiuchiha-vs3qb2 жыл бұрын
WOW! your way of implementing code with explaining clear thought process is legendary. .
@sauravdas75913 жыл бұрын
is it only me, or the audio sounds a bit jittery? very light distortion in audio
@rohankaran00792 жыл бұрын
Sir ap bhagvan hai aise koi samjha hi nai skta hai No content is upto this level in any platform for DSA i bet
@MYSTERIOUS_BOY_1 Жыл бұрын
The best.......................sir❤ Literally NO WORDS...😮 FOR YOUR EXPLAINATION ❤
@somnathroy62512 жыл бұрын
Man this is so good, I regret founding this channel so late.
@Pepcoding2 жыл бұрын
Hope we help you but for better experience and well organised content visit - nados.io 🚀 ⚠️ You can also post your queries on community tab.
@sharuk35453 жыл бұрын
next level explanation with the help of this solution i did it merge K LinkedList problem
@namantiwari82512 жыл бұрын
That's Mind Blowing 💯💯
@aayush4812 жыл бұрын
epic man, no one tells how internally comareTo works !
@pramodbasu7732 Жыл бұрын
5 days back this question was asked to me in VMWARE coding round
@rishabhgoyal28354 жыл бұрын
next level explanation , thank you : )
@Pepcoding4 жыл бұрын
Thank you so much. Keep learning
@sonipra23763 жыл бұрын
Splendid Explanation.
@Pepcoding3 жыл бұрын
Thankyou beta! I am glad you liked it. If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
@mihirsaini592 Жыл бұрын
Great explanation as always.
@mickyman7533 жыл бұрын
instead or writing comparator or comparable ,use this PriorityQueue pq=new PriorityQueue((p,q)->{ return p.val-q.val; });
@shrad66113 жыл бұрын
pure content video sirf kaam ki chize karte ho aur logo ki tarah bakwas nahi luv the video
@Pepcoding3 жыл бұрын
Thankyou beta! I am glad. Your kind words are the kind of motivation that truly help me in making more and more content. Especially, these days, not everybody is generous with motivating anybody either. It means a lot. 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 ) Keep learning and keep loving Pepcoding😊
@shrad66113 жыл бұрын
@@Pepcoding yeah sure
@chandrashekharagrawal48902 жыл бұрын
Woww, this is amazing.
@pranshulkharniwal81463 жыл бұрын
majha aa gya sir✨✨✨✨
@Pepcoding3 жыл бұрын
Thankyou beta! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. 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 )
@ashwinnema062 жыл бұрын
Nice explanation sir
@anirudhatalmale55753 жыл бұрын
very well explained
@Pepcoding3 жыл бұрын
Glad you think so and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@animetimes55633 жыл бұрын
OP level explanation
@Pepcoding3 жыл бұрын
Glad to know, that you love the explanation, for better experience and precisely arranged videos. Visit - nados.pepcoding.com and sign up to NADOS. Don't forget to follow us on Instagram instagram.com/pepcoding/
@amandixit35554 жыл бұрын
public static ArrayList mergeKSortedLists(ArrayList list) { ArrayList rv = new ArrayList(); PriorityQueue pq=new PriorityQueue(); for(int i=0;i0) { rv.add(pq.remove()); } return rv; } sir can we do like this.
@samirray75444 жыл бұрын
understood it very well.......very informative video...........
@Pepcoding4 жыл бұрын
Thankyou beta! I am glad you liked it. I also hope that you are watching till end. Will you like to write a few words about us here (www.quora.com/Which-is-the-best-online-course-to-learn-data-structures)
@samirray75444 жыл бұрын
@@Pepcoding Sir it says page not found
@nextgeneration28354 жыл бұрын
just to the point :) thank you
@Pepcoding4 жыл бұрын
Glad it helped!
@jsuryakt2 жыл бұрын
awesome explanation
@Pepcoding2 жыл бұрын
Glad it was helpful! Keep learning. And for better experience, visit nados.io, where you will get well curated content and career opportunities.
@abhishekvishwakarma90453 жыл бұрын
Great Explanation sir get multiple topics (Interface) also 👌🔥
@Pepcoding3 жыл бұрын
Glad to know that you liked the content and thank you for appreciating. If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc
@utkarshsharma11852 жыл бұрын
thanks sir...
@ghanibhai16303 жыл бұрын
i have used hashmap + priority queue
@runtime3793 жыл бұрын
great sir
@gauravagarwal65653 жыл бұрын
what about : for(int i = 0;i
@bloody91622 жыл бұрын
TC: nlogn where n is the length of all lists combined, using heaps/pq tc gets reduced to nlogk where k is the size of lists array
@deepakjoshi43183 жыл бұрын
Sir Fractional knapsack ki video nhi dali hai apne?
@ankitparashar87303 жыл бұрын
Explanation level
@Pepcoding3 жыл бұрын
If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@RishabhJain-hr6sz3 жыл бұрын
Sir, not able to find fractional knapsack problem on channel. Could you please share the link, since you mentioned in this video. Thanks!
@mehulbisht97084 жыл бұрын
sir to implement an interface in java in android studio we need to annotate the function ( which is declared inside interface ) with @override. Isn't that required for java programs outside android studio ?
@Pepcoding4 жыл бұрын
@override is not mandatory beta. Not even in android.
@mehulbisht97084 жыл бұрын
@@Pepcoding ok thankyou sir
@VISHNUVardhan-mr2cq4 жыл бұрын
Sir, u have not uploaded fractional knapsack?
@Pepcoding4 жыл бұрын
beta daal denge.
@shreeyagupta84723 жыл бұрын
Sir what if we add all the elements of all the arrays in priority queue and then peek and remove them all?
@1piecegaming6223 жыл бұрын
hey..are you following the babbar bhaiya DSA sheet??
@NitinSharma-bk7dw3 жыл бұрын
Complexity will be high if you do so because inserting an element in pq takes log(n). For k^2 element it will be k^2 log k + k^2 iterations for inserting in pq
@hymnish_you4 жыл бұрын
Sir, why didn't u use this simple method? public static ArrayList mergeKSortedLists(ArrayList lists){ PriorityQueue pq = new PriorityQueue(); for(ArrayList ls : lists){ for(int num : ls){ pq.offer(num); } } ArrayList rv = new ArrayList(); while(pq.size() != 0){ rv.add(pq.poll()); } return rv; }
@RishabhJain-hr6sz3 жыл бұрын
Amazing!
@Pepcoding3 жыл бұрын
Thank you! Cheers!
@satvrii Жыл бұрын
❤
@surajpatil28793 жыл бұрын
PriorityQueue pq = new PriorityQueue(); for(int i=0;i
@abhishekjaswal44153 жыл бұрын
what if we add all the elements into a priority queue and simply remove elements from priority queue and just return it its working for me but I guess the time complexity will increase?is it?
@himanshumishra81813 жыл бұрын
Nah not sure about the time complexity but the space complexity is goona get O(sum of size of all arrays ) compared to O(k)
@Pepcoding3 жыл бұрын
Visit - nados.pepcoding.com and sign up to NADOS. You can ask your doubts on community tab. There are lots of programmers and mentors who can help you out with such doubts. Don't forget to follow us on Instagram instagram.com/pepcoding/
@factsstats3959 Жыл бұрын
Can't we just store all values in the Prority Queue First and remove them one by one and print them while removing?
@nishantchaudhary79022 жыл бұрын
can anyone please give me the link of fractional knapsak i'm unable to find it..
@abhishekverma-se6vw4 жыл бұрын
Sir when are you uploading level up?
@Pepcoding4 жыл бұрын
beta ek week baad
@anjneykumarsingh44614 жыл бұрын
Bhai foundation toh pura krne de sir ko bhut cheez baki h
@ashishm88503 жыл бұрын
Unda!
@Pepcoding3 жыл бұрын
Thankyou beta! Keep learning and keep watching😊
@RiteshKumar-nt5sj3 жыл бұрын
compare to k andar pair other kya h? this to pair class ka value hai but other? \
@Pepcoding3 жыл бұрын
For clearing all your doubts and for best experience, visit on nados.pepcoding.com Don't forget to follow us on Instagram instagram.com/pepcoding/
@hungryhunter62104 жыл бұрын
Sir C++ mein objects ki priority queue k liye comparable kaise likhte hai?
@Pepcoding4 жыл бұрын
wahan operator overloading ek rasta hai, doosra functor hota hai. Operator overloading is the usual way.
@hungryhunter62104 жыл бұрын
Thank you for the reply sir.
@umangchhabra96784 жыл бұрын
class Pair { public: int li; int di; int data; Pair(int li,int di,int data) { this->li=li; this->di=di; this->data=data; } }; class FunctorCompare { public: bool operator()(Pair a,Pair b) { return a.data>b.data; } }; priority_queue pq;
@shubhamsood14064 жыл бұрын
@@umangchhabra9678 Can you share your C++ code for this question, I wrote a code but it is not working bcoz of some errors
@akshatbhaskar57112 жыл бұрын
Can anyone please help me telling that what will be complexities of this solution? Btw best video
@Pepcoding2 жыл бұрын
Nlogk
@satyam18_4 жыл бұрын
Sir cant we simply add all list in a priority queue and then print the priority queue ??
@Pepcoding4 жыл бұрын
space jyada lag jaega. O(k) space allowed tha
@creativegiant1483 жыл бұрын
It is bfs Kindoff
@prakritidevverma43153 жыл бұрын
Can we do all this in O(1) memory ?
@Pepcoding3 жыл бұрын
Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.
@prakritidevverma43153 жыл бұрын
@@Pepcoding cool, I'll ask over there.
@indranilchakraborty59493 жыл бұрын
Sir fractional knapsack ka vedio nhi hai pepcoding ka ....
@sauravdas75913 жыл бұрын
aditya verma ka dekh lo video
@raviashwin11573 жыл бұрын
@@sauravdas7591 fractional greedy se hota hai wo nahi padhaya aditya verma ne
@varunsde95333 жыл бұрын
I have solved this by using stream API in Java 8 ArrayList result = lists.stream.flatMap(x->x.stream()).sorted.collect(Collectors.toCollection(ArrayList::new));
@yelp93594 жыл бұрын
Sir iski complexity kya hogi?
@Pepcoding4 жыл бұрын
nlogk
@hdang19974 жыл бұрын
@@Pepcoding where n is total number of elements in all the arrays, correct?
@namanmittal94033 жыл бұрын
@@hdang1997 where n is the number of elements in the longest list and logk is for the priority queue (enque/deque) ignoring the number of list i.e since k
@ayushgoel95844 жыл бұрын
sir heaps ke questions mein confidence nhi aaya, i hope we will do atleast 20 more problems in LU+IP
@Pepcoding4 жыл бұрын
we have a lot many in lu + ip. i think 100 ke kareeb hain, hashmap aur heaps mila ke
@imavij122 жыл бұрын
Ye other ki value kaha se aa rhi h. Compare this ko kis se karega samajh nahi aa rha
@Pepcoding2 жыл бұрын
For better insight, visit nados.pepcoding.com, post your doubts, community will help you out there.
@sarfinawalksh5034 жыл бұрын
Sir, u have not uploaded fractional knapsack?
@Pepcoding4 жыл бұрын
hanji beta, hashmap-heaps ke liye chodda tha firr choot he gya. karna hai