3.1 Knapsack Problem - Greedy Method

Поделиться
HTML-код
  • Опубликовано: 11 июн 2024
  • what is knapsack problem?
    how to apply greedy method
    Example problem
    Second Object profit/weight=1.66
    PATREON : www.patreon.com/bePatron?u=20...
    Courses on Udemy
    ================
    Java Programming
    www.udemy.com/course/java-se-...
    Data Structures using C and C++
    www.udemy.com/course/datastru...
    C++ Programming
    www.udemy.com/course/cpp-deep...

Комментарии • 1 тыс.

  • @Heronstairs536
    @Heronstairs536 4 года назад +551

    4:51 am. 3 hrs till exam. Thank you sir.

    • @Heronstairs536
      @Heronstairs536 4 года назад +11

      @@user-zf3bh4og6f haha goodluck !

    • @gourab469
      @gourab469 4 года назад +5

      @@user-zf3bh4og6f how did it go?

    • @snehashishsrivastava9018
      @snehashishsrivastava9018 4 года назад +4

      @@user-zf3bh4og6f shit that was close

    • @siddhartharoy179
      @siddhartharoy179 3 года назад +5

      @@user-zf3bh4og6f All the best for the next time. You're a genius, you'll surely nail it next time.

    • @isaicsefxec6721
      @isaicsefxec6721 3 года назад

      @@user-zf3bh4og6f how was the result

  • @aravindhravichandran5152
    @aravindhravichandran5152 5 лет назад +737

    I am following a greedy method. I just follow Abdul Bari Sir's lectures blindly ❤️.

    • @_smurar_
      @_smurar_ Год назад +6

      Arey bhai bhai bhai bhai

    • @priyankadubey5483
      @priyankadubey5483 Год назад +9

      How you can learn Algorithms... blindly...you must open your eyes 😂😂😂

    • @studyonline3236
      @studyonline3236 Год назад

      @@priyankadubey5483 Wah Wah

    • @T.JacobMain
      @T.JacobMain 7 месяцев назад

      ​@@priyankadubey5483hearing exists 😭

  • @efyoubadly
    @efyoubadly 5 лет назад +805

    Perfect data structure teacher don't exi---- lol Prof.Abdul bari is the perfection.

  • @Novodip
    @Novodip Год назад +344

    for the newcomers,xipi will be 55.3,not 54.6...There is a slight mistake in the calculation.Amazing Teacher Btw 😎😎

    • @hitesh1800
      @hitesh1800 Год назад +18

      Pi/xi of 5/3 =1.667 not 1.3

    • @ganeshchoudhary8849
      @ganeshchoudhary8849 Год назад +11

      2/3 into 5 = 3.33

    • @meena.9o2
      @meena.9o2 Год назад +27

      Thanks 😭......if you won't have typed it I would have gone into a spiral loop of self doubt that I suck at maths

    • @SameenIslam
      @SameenIslam 10 месяцев назад +9

      Yes, I can verify that sum(x_i*p_i) = 55.33 there was a minor arithmetic error in the lecture.

    • @gcloudysarang
      @gcloudysarang 7 месяцев назад +3

      Yes I have also this doubt but this was mistake by sir .no worries 👍🏻💯Best teacher

  • @maruthupandianm184
    @maruthupandianm184 4 года назад +2161

    Students: why it's so difficult to understand Data Structure and algorithm?
    Prof Abdul Bari: Hold My Camera

  • @khalasianiket816
    @khalasianiket816 2 года назад +118

    Whenever DSA and DAA come into a picture...just say Abdul Bari sir's name...then see the magic...he is hero of DAA and DSA for students like us...lots of love and blessing to you sir😊

  • @karana2260
    @karana2260 4 года назад +95

    Don't look at the weight , Don't look at the weight!
    You are the best DS / ALgo teacher so far sir : )

  • @pintu_patil
    @pintu_patil Год назад +23

    When I see correction at 5/3=1.66 in the i button I can conclude that only these videos of Abdul sir are enough....thank you sir

  • @GAURAVSHARMA-mu6ri
    @GAURAVSHARMA-mu6ri 5 лет назад +282

    we have been taught by many teachers and some of which are good and very few are best but your one of the greatest from them all . thank you so much sir . you are doing the great service to the nation. thank you again for taking out time for making these videos .

    • @chelidoniii
      @chelidoniii 3 года назад +16

      Not just in your nation but in the world!

  • @anhtainguyen3585
    @anhtainguyen3585 3 года назад +79

    Thanks to this video, I had a perfect presentation in college about this problem, and I received praise from my teacher - a Prof for that explanation. Thank you so much, a big respect to Prof Abdul Bari.

  • @dataengrprospect9207
    @dataengrprospect9207 4 года назад +57

    This man is the deal. He explains everything in details. Thank you. I have exam tomorrow. I'm glad I found this video. Had wished I found this out earlier.

    • @nikhilgade201
      @nikhilgade201 2 года назад +1

      Is that optimal solution

    • @manojramesh4598
      @manojramesh4598 Год назад +1

      Same i have internals tommorow and i didn't know how to solve it until now 😂

    • @manojramesh4598
      @manojramesh4598 Год назад

      @@nikhilgade201 Yup 👍

  • @vincentborra6960
    @vincentborra6960 3 года назад +327

    I think there is a slight calculation error: 2/3 of a profit of 5 is 3.33 and so the total profit is 55.33
    Great video anyway! Thank you

  • @sffshuvo
    @sffshuvo 2 года назад +5

    You're a blessing in the field of Computer Science. I've my examination approaching in 2 days and your videos are helping me a lot. May the Almighty keep you well.

  • @franciscocastro4911
    @franciscocastro4911 5 лет назад +9

    You sir are a god of simple explanations. My professor just explained this but reading formulas off a power point. THANK YOU.

  • @nirwanramteke4806
    @nirwanramteke4806 4 года назад +27

    I am going to write all his statements, examples in my theory exam, thank u sir for creating good explanation.
    Greedy Method, Dijkistra algo, Bellman Ford Algo, LCS, NP complete, Knapsack Problem.

  • @aayushsrivastava9569
    @aayushsrivastava9569 3 года назад +6

    World would be a better place if there were more teachers like him.

  • @anjalisn4
    @anjalisn4 3 года назад +43

    Some day, if I step into a teaching career, I would be wanna you!

  • @jaybhatt6775
    @jaybhatt6775 3 года назад +2

    Abdul sir you are a very rare breed of teachers. you explain even the most complicated algorithms so well ane make it so easy for us to grasp the concept. mind-blowing sir!

  • @vaibhavjain2826
    @vaibhavjain2826 5 лет назад +4

    Sir, a big thanks for uploading this playlist! You have explained a theoretical subject in a very logical manner.

  • @explorewithsingh98
    @explorewithsingh98 6 лет назад +15

    The way u teach us is really great - Thanks Sir g

  • @Sanatanabhishekaa28498
    @Sanatanabhishekaa28498 6 лет назад +115

    Crystal Clear 👌👌👌
    A Big Thanks From Kerala 👏👍☺

    • @smarteducation47
      @smarteducation47 3 года назад +2

      100 like

    • @murtazamirzaie1109
      @murtazamirzaie1109 3 года назад +1

      why we can not take 7 amount of the first object?? it would be 70 and that's more than what the prof said??? because we want the mux

  • @hassankarim7084
    @hassankarim7084 5 лет назад +5

    Thanks Dr. Bari! Worth noting for search engines, his is also known as a FRACTIONAL Knapsack Problem, or Container Loading problem with divisible payloads

  • @JX304U
    @JX304U 6 месяцев назад +1

    The best thing about you is that you teach in a relaxed and calm way and it calms me too.😇

  • @goneraone1988
    @goneraone1988 3 года назад +4

    More power to you Sir. You have made this subject easy for us. Never realised that such subjects can be understood at one go. 🙏

  • @muraligunturi5468
    @muraligunturi5468 6 лет назад +175

    The answer is 55.3 for xi*pi

  • @satyanarayanmohanty3415
    @satyanarayanmohanty3415 4 года назад +8

    Algorithms are so much easier when this man teaches.

  • @rusureaboutthat781
    @rusureaboutthat781 3 года назад +1

    I ve watched so many of your videos when I have questions on a topic and everytime the question why do I waste my time on uni lectures pops in my godamn head thank you for your work man it really helps

  • @shahildx3163
    @shahildx3163 4 года назад +1

    Pure teaching... You're the epitome of teaching

  • @srinivb1
    @srinivb1 5 лет назад +7

    Sir, Thank you again for such awesome videos on Data Structures and Algorithms 🙏
    Your videos are very clear and easy to follow.
    DSA subject is becoming my favorite subject because of your wonderful videos. Many Thanks 🙏

  • @TridibSamanta
    @TridibSamanta 5 лет назад +6

    Great ! You are a great Teacher. Thanks for saving my Design and analysis of Algorithm Paper.
    #Respect

  • @knighthashwanth8810
    @knighthashwanth8810 5 лет назад +2

    Sir u r wonderful,I have been watching RUclips subject videos for a long time.but ur explanation is best of all,tq for teaching us 😘

  • @nawnitsen7771
    @nawnitsen7771 5 лет назад

    couldn't be explained more clear​ than this...
    thanks a ton sir!

  • @akshayawasthi599
    @akshayawasthi599 4 года назад +3

    The man of utmost patience and knowledge in teaching.......prof. ABDUL BARI

  • @compilerrun5516
    @compilerrun5516 4 года назад +16

    This man is really a legend.

  • @rsamhitha4707
    @rsamhitha4707 2 года назад

    Thank u very much for covering these topics sir. You make it very easy to understand. Your calm nature and your politeness adds cherry on the top.

  • @BosnMa
    @BosnMa 3 месяца назад

    Thank you Abdul bari, best course I've found. Your kindness and generosity enlight countless developers.

  • @sanusingh4192
    @sanusingh4192 6 лет назад +3

    you are a great teacher,thank you very much,keep uploading such videos

  • @bhavyanukala3233
    @bhavyanukala3233 5 лет назад +4

    I think he is the best......even though he is not teaching the algorithm.....he will make us understand within a few minutes.....magic🤗

  • @djthedev
    @djthedev 4 года назад +1

    Thank you so much these videos are so helpful! Great job explaining and demonstrating the algorithms

  • @prayagparikh8020
    @prayagparikh8020 5 лет назад +2

    Your videos are too too too much helpful to me!THANK YOU

  • @brijpatel237
    @brijpatel237 5 лет назад +16

    Thanks Sir!..just add in description than value of profit is 55.33

    • @drewkelly3622
      @drewkelly3622 Месяц назад

      glad i got this total as well. He made a mistake when doing 2X1.3 when it shouldve been 2/3 X 5 = 10/3 = 3.3333333

  • @houghtonabhi
    @houghtonabhi Год назад +40

    I think there is a slight calculation error at 06:40 & 12:36min., 5/3 is 1.6, so the final profit is 55.34
    btw before commenting I calculate over 10 times😂
    Thank you so much sir🙏

    • @priyanshuawasthi1061
      @priyanshuawasthi1061 Год назад +1

      Exactly i also calculated many times.

    • @3dDigitalArtToday
      @3dDigitalArtToday Год назад +1

      i thought it should be 55.2(mind calculation) but after i used my calculator it said, 55.33333..... that is 55.34 which is correct

    • @houghtonabhi
      @houghtonabhi Год назад +1

      @@3dDigitalArtToday Exactly

    • @MuhammadIrfan-cj1cq
      @MuhammadIrfan-cj1cq Год назад +2

      broo i thot how come i cant even calculate this simple math hahha ,my whole engineering is a lie ;)

    • @ris99
      @ris99 Год назад +1

      thnks

  • @MultiPleaser
    @MultiPleaser Год назад

    I was going to make a video showing this method, because nobody had mentioned it yet. They all had super complicated algorithms that boggled the mind.
    Glad someone already figured out this method (it's the best), and now I don't have to make a video. Thanks!

  • @thrilleracaste400
    @thrilleracaste400 2 года назад

    This is one of the best playlist for algorithms. Thank you sir!!

  • @southtowndunky8882
    @southtowndunky8882 3 года назад +15

    Even if i quit studies pretty sure i'll remember him till the day i die :'3

  • @rajakunalpandit3594
    @rajakunalpandit3594 2 года назад +4

    Happy teacher's day sir 🎉

    • @abdul_bari
      @abdul_bari  2 года назад +2

      Thanks Krishna.

    • @rajakunalpandit3594
      @rajakunalpandit3594 2 года назад +1

      @@abdul_bari love you sir, you are the only reason of mine to continue DSA ❤️❤️❤️❤️❤️❤️❤️❤️❤️

  • @akashjadhav1274
    @akashjadhav1274 5 лет назад +1

    Thank you sir for such quality videos, I totally love the way you explain. You are amazing!

  • @nandinimhamane6405
    @nandinimhamane6405 5 лет назад

    was struggling a lot with this....... finally understood now!!!! thank you so much sir!!!!

  • @saikiranbandla1804
    @saikiranbandla1804 4 года назад +5

    The final answer is 55.3, not 54.6
    any way ur explanation is great. thank you

  • @NotSionnix
    @NotSionnix 4 года назад +7

    This man really is the GOAT on YT for CS students :pray:

  • @eva42sh
    @eva42sh 2 года назад

    thank you Mr Abdul for allocating your time for making these awesome educational videos

  • @loveleshsharma5663
    @loveleshsharma5663 6 лет назад +1

    Ultimate explanation!! This topic is clear in my mind after watching this video.

  • @pradipnitw
    @pradipnitw 6 лет назад +5

    this is awesome.. Sir I would request you to give us a snapshot of how we would code it.. even a psedo code would help a lot.

  • @upendrakushwaha5123
    @upendrakushwaha5123 5 лет назад +4

    Excellent explanation ,thanks for such a helpful video

  • @ankushmukherjeeofficial9601
    @ankushmukherjeeofficial9601 5 лет назад +2

    Thank u sir....... I hv started following your lectures and am fully satisfied with the explanation....

  • @varunreddy3873
    @varunreddy3873 4 года назад

    u are the leading teacher in youtube regarding to topic algorithms

  • @syedriyaz3227
    @syedriyaz3227 5 лет назад +7

    Jazakhallahu Khair sir cleared my subject just because of u,❤️❤️

  • @manisht5776
    @manisht5776 3 года назад +6

    I know just thank you is not enough for this. But still thank you sir. I feel like cheated by the college they took so much fee and taught me nothing. All they taught me is to mug up.

  • @haxpor
    @haxpor 4 года назад +1

    Very good explanation, concise and quick to understand. Thank you sir.

  • @nehapant151
    @nehapant151 5 лет назад

    The way of explaining is appreciable ... and moreover content is giving very clear vision to problem in a short video time..

  • @mahmoodkashmiri
    @mahmoodkashmiri 6 лет назад +5

    Love from Kashmir
    Thanks sir

  • @robinkumar9021
    @robinkumar9021 5 лет назад +4

    thank you for your video ,sir

  • @alessiodenny6123
    @alessiodenny6123 4 года назад

    thank you for taking your time to make these brilliant videos ! Very helpful to me.

  • @rohanmudvari
    @rohanmudvari 4 года назад +1

    Thank you sir. This would be really beneficial for me on board exams.

  • @saisky4392
    @saisky4392 6 лет назад +3

    its an awesome teaching tku MR>ABDULBARI

  • @shireenkhan7569
    @shireenkhan7569 6 лет назад +9

    max profit will be 55.33 not what you mentioned!!
    well explained!!

  • @salmanshahid8128
    @salmanshahid8128 2 года назад +2

    Loved your effort that you put Sir! I really wish that you had been our teacher. Our marks and performance in the exams would significantly improve then, that's for sure.

  • @harshilbulsara4053
    @harshilbulsara4053 5 лет назад

    Amazing sir.What an excellent way to teach.Its pretty much all clear in my mind. THANK YOU 👌👌👌👍👍👍

  • @moustafah1
    @moustafah1 5 лет назад +3

    Hello Sir,
    First, Thank you from Sweden for this perfect explanation.
    Can you please give an exchange argument to prove the correctness?
    Or is there a video about that ?

    • @moustafah1
      @moustafah1 5 лет назад

      I actually have a counterexample, can I get in contact with you please?

  • @palthypraveen6633
    @palthypraveen6633 2 года назад +4

    Sir.. 5/3=1.6

  • @ammarahmad-courtdeo9815
    @ammarahmad-courtdeo9815 5 лет назад +1

    Thanks for a wonderfull explanation :)
    you've made these horrible concepts soooooo much easy to understand. :)

  • @reassume4826
    @reassume4826 5 лет назад

    I really appreciate the power of internet. Had it not been internet Abdul sir would have been limited to only few students but not we all are his students.
    Abdul Kalam ji did a lot for country and Abdul sir is also doing his best. We need more people like him.

  • @djBC10000
    @djBC10000 5 лет назад +51

    The error is happening when he divides 5/3, he wrote 1.3 when it is 1.6, so all of the calculations that follow will be off

    • @kirankamath5891
      @kirankamath5891 4 года назад

      exactly

    • @sneiLF4
      @sneiLF4 4 года назад

      1.7

    • @samboy05
      @samboy05 4 года назад +15

      doesn't matter - he is trying to teach the thought process not the exact solution

    • @roushangiri4722
      @roushangiri4722 3 года назад +3

      He did mention in the annotation about it.

    • @prashantgupta6885
      @prashantgupta6885 3 года назад +10

      The error is with our education...soo obsessed with the calculation and not the concept...computers are there, testers are there...dont worry...what matters is you to solve a program like this as a developer...you can debug things anytime

  • @manisharastogi2459
    @manisharastogi2459 6 лет назад +5

    Awesome

  • @hingsing1
    @hingsing1 Год назад +2

    you are my favorite professor at youtube university, dr professor master sensei abdul bari sir

  • @uniquetrendbeats9094
    @uniquetrendbeats9094 3 года назад +1

    Thank you sir for providing such understandable videos with logical examples

  • @loginid7108
    @loginid7108 6 лет назад +6

    ╬ such professional way for teaching ╬

  • @pearlminestudios7568
    @pearlminestudios7568 5 лет назад +4

    7kg washing machine😂.. it’s just funny when I imagine cutting the washing machine to fill the bag.

  • @iqdarshah
    @iqdarshah 3 года назад

    Sir I am very much thankful to you, you have prepared me to give exams of Design and Analysis of Algorithms

  • @sanchittanwar6073
    @sanchittanwar6073 5 лет назад

    The content of videos are great and u can easily watch them at 3x thanks sir.

  • @VikasVerma-px3sl
    @VikasVerma-px3sl 3 года назад +3

    "Write a non-deterministic knapsack algorithm"
    Sir help
    Or anyone help me in this problem some hint about this problem
    Please

  • @AskarAlmazovich
    @AskarAlmazovich 5 лет назад +9

    I think 2/3* 5 =3.3 but not 1.3 right? o_O

  • @pratikshaha2965
    @pratikshaha2965 6 лет назад +1

    and also you gave diffrent diffrent examples for the topic its very good to understand give more examples related to the topic thats way the students can understand the topic

  • @7franky7777
    @7franky7777 5 месяцев назад

    Legend for a reason ⭐.Still can't forget how easily you taught N queen problem

  • @jayantasamaddar1446
    @jayantasamaddar1446 Год назад +7

    There's a small calculation mistake (human error). The total profit is 55.333333333333336. The error is around the calculation of 2/3*5. By mistake Prof. Bari has instead used the profit by weight as 1.3. It's 1.6666666666666667.

  • @redherring9727
    @redherring9727 2 года назад +3

    Why can't you be my professor instead :(

  • @dariushkazemi268
    @dariushkazemi268 3 года назад +1

    Great tutorials man! Keep up the good work mate.

  • @poojitha4683
    @poojitha4683 2 года назад +1

    Sir, You are the only choice for my exams More than books..Thankyou sir

  • @aryanjain
    @aryanjain 2 месяца назад +4

    Watching in March 2024

  • @_a_r_un_
    @_a_r_un_ 5 месяцев назад

    When ever i need any algorithms i firstly come to the abdul bari sir channel only ❤
    Best explanation ever

  • @shabarish2727
    @shabarish2727 4 года назад

    Sir, explained extremely well.
    Thank you soo much !

  • @layab1568
    @layab1568 4 года назад

    Sir truly you are the best in making students understand easily and effectively

  • @saddamahmad2310
    @saddamahmad2310 5 лет назад +2

    thank you very much sir for all these videos your videos are really helpful to us

  • @sudeshraina3714
    @sudeshraina3714 3 года назад

    Sir, you are building the future of our country. Thanks a lot!

  • @parassaini9010
    @parassaini9010 3 года назад

    Sir, thank you, you're method of teaching is so awesome..

  • @haripriyaa4648
    @haripriyaa4648 6 лет назад

    Thnks sir,ur teaching is so good and easy to understand the problems

  • @pelin576
    @pelin576 Месяц назад

    you are the best teacher I have ever seen. thank you

  • @mazharbukhari786
    @mazharbukhari786 3 года назад

    Sir, I appreciate your way of teaching, impressive.

  • @vishnusai5885
    @vishnusai5885 6 лет назад +1

    Thank you
    Sir.
    I had learned a lot from this viedo....

  • @mamunmahmudove157
    @mamunmahmudove157 2 года назад

    Best Knapsack problem explained video ever, sir.