0/1 Knapsack Problem Using Dynamic Programming - Tutorial & Source Code

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ม.ค. 2025

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

  • @burakb8708
    @burakb8708 4 ปีที่แล้ว +44

    I am shocked by the contrast between the quality of the video and the number of views and subscribers. I've been watching knapsack problem videos lately because of a homework I had issues with and this video is the only one that makes sense to me.

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

      Thanks for the compliment! Hopefully the contrast will be reduced in the upcoming months, but only on the basis of more viewers and subscribers =). The 01 Knapsack algorithms is a good one to know because there are many other dynamic programming problems that are very similar. Let me know if there are other topics that you'd like to see discussed.

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

      ​@@stablesort This channel deserves much better indeed. I'd love to see a video about find the contiguous subarray with the maximum sum problems using Kadane's algorithm or other algorithms.
      www.geeksforgeeks.org/largest-sum-contiguous-subarray/

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

      I agree with you. I almost just swiped pass this video.

  • @Jerry-uc1pn
    @Jerry-uc1pn 3 ปีที่แล้ว +7

    Wow, I am astounded at the quality of this video. It explains the concept so clearly and the video editing was great. Thanks a lot. It also helped me for a programming job interview assignment

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

      I am glad to hear it! Thanks for the compliment!

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

    0:34 interrupted my eternal crankiness.
    I hope that you will have the time and motivation to make more of this excellent material.

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

      Thanks for the good words! I got a lot of motivation but time has been the limiting factor as of late.

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

    the clearest explanation on this topic by far! thank you good sir!

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

      Thanks for the compliment, Kevin!

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

    I'm so happy I found this channel! Your videos are very well done!

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

    This is what I have been looking for

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

    Thanks for this. I hope no one broke into your home with this😁

  • @rajeevjha1878
    @rajeevjha1878 4 ปีที่แล้ว +8

    it was really great video!

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

    I watched 5 videos before this and only this one made sense

  • @RajanSingh-yq5dx
    @RajanSingh-yq5dx 4 ปีที่แล้ว +2

    Just watched the video and subscribed
    Keep up the good work sir

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

      Thank you! By the way, there is another "Dynamic Programming" episode currently in the making. I am hoping to finish it in next few days. Stay tuned!

    • @RajanSingh-yq5dx
      @RajanSingh-yq5dx 4 ปีที่แล้ว

      @@stablesort Great it will help a lot

  • @JP-ic5we
    @JP-ic5we 3 หลายเดือนก่อน

    God bless you zen programmer this information is super useful

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

    Thank you for the clear explanation. New subscriber

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

      Thanks for posting a few good words

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

    Awesome stuff!! Please keep it up

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

      Thanks! More to come!

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

    1:02 That's pretty much what I do in Skyrim when looting dungeons with too much stuff

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

      hahaha =)

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

      Imagine a mod that tells you to drop 30 items because the 10 nearby are more optimal according to the knapsack solver it has running.

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

    Great explanation, you just shared jewellery location to thieves 😂😂😂

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

      It's mostly glass and plastic =) Thanks for the compliment!

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

    really greaty videos

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

    Amazing so clear

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

    Haha, nice video!

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

    Please can you repeat with slow numerical procedure (using numbers please in schedule with Value $100) how to find in previous table with numbers items that we put inside the knapsack to get W and Value 100. I calculated the whole schedule and I have fgot Value $100 using recursive formula. Is the solution item 2 = 4 kg and item 4 is 3 kg or 7 kg from 10 kg? Then I have $ 40 + 60 = $100? Pleae finish your lecture with result. Thanks a lot. JABO

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

      In ask you to explain like this the procedures how to find items to fill knapsack (Schedule with numbers)
      4) 7 -4 = 3 so go to raw 2 and pick up number in column 3 which is 0; finish.
      3) move above to row 2 because there is also number for Value 40$
      2) 3 rd row 7th column is value 40$
      1) 10 - 7 = 3 (number 100$)

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

      Hi JABO, I am not 100% sure that I understand your question. It looks like you also posted a reply to it, so may be you already figured it out by yourself. In any case, I invite you to take a look at the source code. Here is an implementation in Java:
      bitbucket.org/StableSort/play/src/master/src/com/stablesort/challenge/Knapsack01.java
      or if you prefer JavaScript:
      bitbucket.org/StableSort/play/src/master/js/01knapsack/01knapsack.js
      I hope that helps.

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

    Plz share this ppt

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

      Sorry, I am sharing the full Java source code, but unfortunately I can't share the ppt.

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

    I like your batik

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

      Thanks =) It brings up memories of an amazing trip to Indonesia.

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

    Do you accept donations?

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

      Thanks for asking but neah, this is just a hobby :)

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

    You're wearing batik.

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

      =) a souvenir from Indonesia - what better occasion to wear it than on youtube!