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

Sdílet
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 Write Priority Queue using Heap.
    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

Komentáře • 87

  • @kumarpriyansh4238
    @kumarpriyansh4238 Před 3 lety +30

    This is gem sir. It took me a minute to process how beautifully you taught this concept easily .I have been through some other videos too but my search ends here.

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Glad it helped! 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 )

  • @rambhaktuchihaobito7987

    Your explanation was amazing! You broke it down perfectly.
    Thanks for being such a great teacher!❤❤

  • @ShivamKumar-qk3vd
    @ShivamKumar-qk3vd Před rokem +1

    Finally ,I found BHAGWAN!!
    I was tying to understand this from long time but was not getting any clear explanation ,but randomly I found this GEM which cleared my all doubts from its lustre and shine... THANKYOU VERY MUCH FOR THIS AMAZING EXPLANATION.

  • @shrinidhiym6499
    @shrinidhiym6499 Před rokem +1

    Perfect GURU for DSA, Nobody can teach DSA like you Sir.

  • @new2halder627
    @new2halder627 Před 3 lety +1

    Your explanation is second to none. Keep up the good work .

  • @amartyagunjan
    @amartyagunjan Před 3 lety

    Sir, It's fun learning with you. Thank you so much for making these awesome tutorials. I really loved it.

  • @InderjeetSingh-lb5rk
    @InderjeetSingh-lb5rk Před 2 lety +1

    Sir this is over powered...thanks a ton!!😁😁

  • @prashantmaitra3361
    @prashantmaitra3361 Před 2 lety

    this is very useful and crystal clear video. thank u sir for best explaination.

  • @sukanyasinha3583
    @sukanyasinha3583 Před 3 lety +1

    great explanation sir
    Thankyou !!

  • @thewarrior2622
    @thewarrior2622 Před 2 lety

    really good explanation. How easy it is. Thank you for great explanation

  • @Jbwemet
    @Jbwemet Před rokem

    Amazing Sir, thank you for this valuable session.

  • @amansharma889
    @amansharma889 Před 2 lety

    you are magician sir too good sir Love from Indore

  • @AshutoshKumar-es8xy
    @AshutoshKumar-es8xy Před 2 lety +1

    Thanks sir . You are a legend

  • @diptendumandal8354
    @diptendumandal8354 Před rokem

    Best Heap video ever.

  • @baidyanathroy7726
    @baidyanathroy7726 Před rokem

    Brilliant Explaining

  • @rambo4014
    @rambo4014 Před 2 lety

    Tussi great ho sir jee!!! bhagwan aapka bhala kare

  • @priyanshuaggarwal5318
    @priyanshuaggarwal5318 Před 2 lety

    Great explanation 👍

  • @SumitKumar-sx1oi
    @SumitKumar-sx1oi Před 3 lety +1

    amazing explanation

  • @hymnish_you
    @hymnish_you Před 3 lety +3

    Sir you are God + Gold ! Happy Teacher's Day.

    • @Pepcoding
      @Pepcoding  Před 3 lety +5

      Thank you beta!! gold to aap mujhe bnaooge achii placements lekrr

  • @ankitphophalia9849
    @ankitphophalia9849 Před 3 lety

    Awesome explanation..i have seen so many videos and even bought some courses..none of them was so crystal clear as this. Than You for all your efforts.

    • @Pepcoding
      @Pepcoding  Před 3 lety +5

      Beta sbka apna apna pdane ka tarika h aur jo jo faculities h hmare paas unhone mjhse zda bache place kraye h abhi tak, to I'll say that vo mjhse zda effort daalte h apne kaam main.

  • @mehulbisht9708
    @mehulbisht9708 Před 4 lety +5

    18:46 sir you are making amazing tutorials ! i have a doubt here, is it mandatory for the class Priority Queue to be static here ? actually i knew basics of c++ from school and this year i started android directly with kotlin , so have this doubt in java syntax.

  • @rishabhgoyal2835
    @rishabhgoyal2835 Před 3 lety +1

    next level explanation , thank you : )

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Keep supporting with your comments

  • @rahuljha8038
    @rahuljha8038 Před 3 lety +1

    sir aap bahut awsome ho

  • @abhikumar2469
    @abhikumar2469 Před 3 lety

    U r a dhaansu teacher🙏🙏

  • @adarshverma5048
    @adarshverma5048 Před 3 lety

    Great Explanation!

  • @rishabhkukreja6910
    @rishabhkukreja6910 Před 4 lety +2

    Thanku for all the videos Sir
    You are doing a really wonderful work for all the students
    You really are inspiring many of us and we appreciate your work a lot

    • @Pepcoding
      @Pepcoding  Před 4 lety +1

      Thank you so much. If you like the content, please subscribe and share around in your college whatsapp groups.

    • @rishabhkukreja6910
      @rishabhkukreja6910 Před 4 lety

      @@Pepcoding already done sir

  • @harshitkaushik4144
    @harshitkaushik4144 Před 3 lety

    Seriously sir commendable job , first time thodi dikkat hui dimag me baithane me lakin second attemp me crystal clear sir

  • @harishvasisht782
    @harishvasisht782 Před 3 lety

    Best ever found on internet 👌

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      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 )

  • @tanveershaikh4639
    @tanveershaikh4639 Před 3 lety

    Amzing tutorial sir 👍

    • @Pepcoding
      @Pepcoding  Před 3 lety

      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/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @shubhamagarwal9321
    @shubhamagarwal9321 Před 3 lety

    Really nice explanation sir.☺

    • @Pepcoding
      @Pepcoding  Před 3 lety

      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 review about us here - g.page/Pepcoding/review?rc

  • @suyashlale7315
    @suyashlale7315 Před 2 lety

    Why are we assuming it to be a left child to the parent in upheapify()? It can be that the function is called with the last index element being a right child to its parent. Please help clarify. Thanks!

  • @ueeabhishekkrsahu
    @ueeabhishekkrsahu Před 3 lety

    legend is back #sumit sir

  • @LegitGamer2345
    @LegitGamer2345 Před 3 lety +1

    neat!

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou!
      Keep learning and keep growing!😊

  • @rohit8021
    @rohit8021 Před 2 lety

    uttam sir

  • @akatsuki1363
    @akatsuki1363 Před 3 lety

    Wow👌👌maza a gaya👏🔥

    • @Pepcoding
      @Pepcoding  Před 3 lety

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber

    • @akatsuki1363
      @akatsuki1363 Před 3 lety

      Already done sir

  • @imavij12
    @imavij12 Před 2 lety

    Ye data.size()-1 k chakkar me pure video me confuse raha mai 😅
    But chalo end me sahi ho gaya. Awesome explanation sir.

    • @Pepcoding
      @Pepcoding  Před 2 lety

      For better experience, visit nados.pepcoding.com, where you will get well curated content and career opportunities.

  • @DurgaShiva7574
    @DurgaShiva7574 Před 2 lety

    indeed, this is a search ending video !!!

    • @Pepcoding
      @Pepcoding  Před 2 lety

      For better experience and well-organised content
      Visit - nados.pepcoding.com
      You can post your query on community tab.
      Don't forget to follow us on Instagram
      instagram.com/pepcoding/

  • @rahulbhatia3075
    @rahulbhatia3075 Před 4 lety +1

    Sir, if we want to remove elements in descending order then how will we write the compare to function?

    • @Pepcoding
      @Pepcoding  Před 4 lety +4

      return statement mei jo return kar rhe hai compareto function ki, uss output ko -1 se multiply kar do

    • @rashichawla448
      @rashichawla448 Před 3 lety

      @@Pepcoding ye to mergeKSorted mai descending order ke liye ho sakta hai, usme to Collections.reverseOrder() bhi use kar painge but sir is question mae descending ke liye upheapify aur downheapify mai signs hi change karne padenge na?

  • @pranjalbajpai9956
    @pranjalbajpai9956 Před 2 lety +3

    Up heapify ka logic galat hai sir, Parent ka index calculate krne me apne ye assume kr lia ki left child add hua hai...it is possible ki right child add hua ho...so pi = (i-2)/2 is also possible

    • @sanatasneem2674
      @sanatasneem2674 Před 2 lety

      floor value lenge na toh -1 and -2 dono ka cade cover ho jaega bcox when we divide it by 2 then .5 ka difference aayega and usme floor lene se cover ho jaega

  • @paurushgargtube
    @paurushgargtube Před 3 lety

    Amazing.. simply the best..

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thankyou beta!
      I am glad you liked it. I hope that you are watching the videos till the end. If you like our efforts, will you like to write a review about us here - g.page/Pepcoding/review?rc

  • @ayushgoel9584
    @ayushgoel9584 Před 4 lety +1

    waiting for hashmap implementation video sir

    • @Pepcoding
      @Pepcoding  Před 4 lety

      I have made it available. It is with the video-editting team. They will most likely post it 2mrw

  • @ayushgoel9584
    @ayushgoel9584 Před 4 lety +1

    sir ek video sirf comparator and comparable par bhi bana dijiye jaise aapne iterator and iterable par bnayi thi

    • @Pepcoding
      @Pepcoding  Před 4 lety +4

      bnai hui hai. Kal dalegi. Par wo thodi gobar bani hai. Dekhna ek baar, most likely wo replace karni padegi. Usme jyada repeat kia hai same point baar baar maine. Baaki sab theik hai. Kal aaegi.

    • @ayushgoel9584
      @ayushgoel9584 Před 4 lety +1

      @@Pepcoding No problem sir, repeat kia hai toh achi baat hai, dimaag mein set ho jaegi

  • @somith16
    @somith16 Před 4 lety +2

    Sir make a video on how to check is binary tree a heap

    • @Pepcoding
      @Pepcoding  Před 4 lety

      Ji, levelup ka question hai. dalega.

    • @somith16
      @somith16 Před 4 lety

      @@Pepcoding ji sir daliya pls thanks

  • @SKM-ti6bh
    @SKM-ti6bh Před 7 měsíci

    When you are saying ‘higher value element have lower priority’ please say the reason behind this , as a hint.

  • @ketansharma6955
    @ketansharma6955 Před rokem

    downheapify mein toh base condition daali hee nahi hui hai ?

    • @kek_potato696
      @kek_potato696 Před 3 měsíci

      basically after swappings the recursion stops when either the current node has no children or it is smaller than both of its children, in which case no further swapping is needed and the method returns, effectively ending the recursion for that particular call.

  • @ayushgoel9584
    @ayushgoel9584 Před 4 lety +1

    Sir heap and hashmap ke questions portal pe upload karwa dijiye

  • @rishabhkesharwani8305
    @rishabhkesharwani8305 Před 3 lety +1

    zero is sacred place ...hahhaha best explanation ever

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      I am glad you liked it. I also hope that you are watching till the end and trying to understand the what, how, and especially why of the problem. If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc

  • @NiranjanKumar-cb8si
    @NiranjanKumar-cb8si Před 4 lety +2

    sir , hashmap ki implementaion ka video bhi do plss

    • @Pepcoding
      @Pepcoding  Před 4 lety +1

      han beta, mai bna chuka hun. video-editting team ke paas hai. kal dalega.

    • @NiranjanKumar-cb8si
      @NiranjanKumar-cb8si Před 4 lety

      @@Pepcoding thank u so much sir

  • @goodpeople7615
    @goodpeople7615 Před 4 lety +3

    Sir dp on trees ki separate playlist will be helpful :-)

    • @goodpeople7615
      @goodpeople7615 Před 4 lety +1

      Will you upload it ?

    • @Pepcoding
      @Pepcoding  Před 4 lety +4

      Yes, sure. Ek baar enough volume ban jane dijie. Organise tarah tarah se kar denge.

  • @anjneykumarsingh4461
    @anjneykumarsingh4461 Před 3 lety +1

    Tree k chasma

  • @code7434
    @code7434 Před 4 lety +1

    Tough DP, GREEDY QUESTIONS