L13. Fractional Knapsack Algorithm

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 115

  • @shwetathakare1556
    @shwetathakare1556 5 месяцев назад +24

    Understood. Striver ,String series please its much needed!!!!

  • @sandeepxt99
    @sandeepxt99 6 месяцев назад +9

    I study DSA in many courses but trust me such a way, you teach never found.l❤

  • @unfamousgaayak4838
    @unfamousgaayak4838 5 месяцев назад +16

    Hello bro , subscribed to ur channel today .. started late but one day even i have hopes that i will understand complex dsa problems. I want to switch from service based to product based .. the kind of work u r doing for us is truely inspirational. Keep inspiring us ❤❤

    • @SibiRanganathL
      @SibiRanganathL 2 месяца назад

      keep rocking bruh
      One day you ill become @famousgaayak4838

  • @Dsa_kabaap
    @Dsa_kabaap 6 месяцев назад +56

    Sir please start making videos on strings and stacks

    • @arunbhagat8023
      @arunbhagat8023 5 месяцев назад +1

      Recursion and Backtracking please

    • @shreyanshsrivastav6773
      @shreyanshsrivastav6773 5 месяцев назад +2

      @@arunbhagat8023 There is already a playlist on recursion by striver

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

      @@shreyanshsrivastav6773 that is basic

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

      @@shreyanshsrivastav6773 it is basic

    • @AmandeepSingh-rd6ql
      @AmandeepSingh-rd6ql 5 месяцев назад

      ​@@arunbhagat8023 please share the joint you are smoking 🚬

  • @guptaujjwal
    @guptaujjwal 6 месяцев назад +15

    Strings and stack queues after this please!

  • @52nevil36
    @52nevil36 6 месяцев назад +3

    Heart from india.. watching from 🇨🇦

  • @deveshsharma-u2l
    @deveshsharma-u2l 4 месяца назад +1

    did it myself ,thanks for building up my logic uptill now heres the code i did:class Solution {
    static class Pair implements Comparable{
    double ratio;
    int index;
    public Pair(int index,double ratio){
    this.index=index;
    this.ratio=ratio;
    }
    @Override
    public int compareTo(Pair p1){
    return Double.compare(p1.ratio,this.ratio);
    }
    }
    // Function to get the maximum total value in the knapsack.
    double fractionalKnapsack(int w, Item arr[], int n) {
    PriorityQueuepq=new PriorityQueue();
    for(int i=0;i

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

    Recursion Backtracking Strings and Stack Next Please...

  • @mmbmmbmmb
    @mmbmmbmmb 4 месяца назад +8

    sir apne private kyu krdi stack best playlist thi

  • @_thingsthatmatter
    @_thingsthatmatter 5 месяцев назад +2

    sir i love your vidoes u make dsa look very easy. i did linked list from you and understood all the concepts but stack and queue is something I am facing a lot of challenge with. can you please after this playlist complete the stack and queue playlist.

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

    we can easily solve this with the help of comparator just add all these values into a vector then just sort using a comparator on the basis of its unit weight then just for loop from 0-n-1 add weights if its larger then just add a else statement where you perform the knapsack fraction condition simple and best🥰🥰

  • @iamnoob7593
    @iamnoob7593 5 месяцев назад +1

    Completed , Thanks a ton striver

  • @priyanshpatro4548
    @priyanshpatro4548 4 месяца назад +7

    why did you remove the stack and queues playlist aadha kiya tha

  • @riyan-g-4
    @riyan-g-4 4 месяца назад +8

    Hey striver, please make the Stack Queue series public. I was in the middle of a video lol

    • @Deepakkumar-pm2kt
      @Deepakkumar-pm2kt 4 месяца назад

      why he did private bro????

    • @ASHUTOSHSHARMA-us6hd
      @ASHUTOSHSHARMA-us6hd 3 месяца назад +1

      paise mangega na abhi toh, tuf+ pe krega mujhe lgta hai

    • @abhimanyuambastha2595
      @abhimanyuambastha2595 2 месяца назад

      @@ASHUTOSHSHARMA-us6hd Its back up!!

    • @manansanghani1032
      @manansanghani1032 14 дней назад +1

      @@ASHUTOSHSHARMA-us6hd fr bro , now i understand why he never upload strings on yt , bhai ko bhi course bechna h

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

    understood, thanks for the perfect explanation

  • @viewer1821
    @viewer1821 4 месяца назад +6

    stack series coming soon!!
    saw striver's leetcode profile he solved stack problems 😁

  • @ashishpradhan6250
    @ashishpradhan6250 4 месяца назад +1

    this playlist also done... thanks

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

    Understood,Greate explanation.

  • @codewithsanjeev4236
    @codewithsanjeev4236 5 месяцев назад +3

    Please bring string series

  • @vivekbhore5722
    @vivekbhore5722 Месяц назад +1

    done n dusted 🔥

  • @somith16
    @somith16 6 месяцев назад +3

    Recursion playlist needed

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

    understood ♥...... next heaps playlist please🥺!!!!

  • @guneeshvats46
    @guneeshvats46 4 месяца назад +11

    Striver why did you remove the Stacks and Queues Videos from your channel ?????

  • @karthik-varma-1579
    @karthik-varma-1579 Месяц назад +1

    Undertstood but java Comparator is new to me

  • @Ayush-777
    @Ayush-777 5 месяцев назад +6

    A2Z DSA course , I am a new learner and found that some videos are coming soon, and in step 2, only counting frequencies of array elements and other videos are not uploaded. Please guide me on what we have to do here.

    • @lifehustlers164
      @lifehustlers164 5 месяцев назад +2

      bhai leave them basics must have been clear and now move to arrays directly.

  • @k-nl4kj
    @k-nl4kj 4 месяца назад

    done with greedy it was freaking awesome

  • @resha7601
    @resha7601 4 месяца назад

    Hey Striver! Will there be a SDE SHEET CHALLENGE 2024? Love the work you do for the community

  • @karthikeyanv4128
    @karthikeyanv4128 4 месяца назад +14

    hey striver why u did stack and queue playlist as private

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

      Yes last night it was uploaded and now its not there what happened?

  • @user-rdr1712
    @user-rdr1712 3 месяца назад

    Series completed 😄

  • @sushmi6400
    @sushmi6400 4 месяца назад +3

    Where is stacks playlist...?striver...

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

    Nice! Thanks for clear explanation. May i know which pen/tablet and app you are using for this teaching ?

  • @abromioitis
    @abromioitis 5 месяцев назад +2

    vote for System Design 👇👇👇👇

  • @yaswanthgummadi7318
    @yaswanthgummadi7318 4 месяца назад +1

    Bro can you please solve the problem "STRONG PASSWORD CHECKER" in leetcode question no.420. And make a video on it.

  • @hat_awesome21
    @hat_awesome21 4 месяца назад +3

    Sir ppz start stack and queue and strings 😢

  • @thoughtsofkrishna8963
    @thoughtsofkrishna8963 5 месяцев назад +1

    Waiting for strings playlist

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

    love u bro💓

  • @watch2-grow
    @watch2-grow 2 месяца назад

    Understood

  • @Umesh-sk7km
    @Umesh-sk7km 6 месяцев назад +1

    understood

  • @AbhishekSharma-26
    @AbhishekSharma-26 5 месяцев назад +2

    please upload the videos of string

  • @woebegonetv
    @woebegonetv 5 месяцев назад +2

    Segment Tree videos plz

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

    Thank You!..

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

    We are the Zeta alpha and none other than sorcher ones

  • @Deepakkumar-pm2kt
    @Deepakkumar-pm2kt 4 месяца назад +1

    bro public the stack and queue playlist again plss

  • @niranjanvs6599
    @niranjanvs6599 5 месяцев назад +1

    I need Strings and Recursion videos

  • @Sharath_Codm
    @Sharath_Codm 4 месяца назад +1

    Start Doing on Strings please sir

  • @45vinitthakkar56
    @45vinitthakkar56 5 месяцев назад +2

    Stacks Queues plzzzzzz

  • @vighneshmudaliar3306
    @vighneshmudaliar3306 6 месяцев назад +4

    ye toh sach h ki bhagwan h

  • @BeWarrior-dw4br
    @BeWarrior-dw4br 4 месяца назад +1

    Stack and Queue series kyun udd gayi?????

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

    @takeUforward bhaiya pleasee give the codes too! THANKS A LOT

  • @sonalipsadwibei2508
    @sonalipsadwibei2508 4 месяца назад +1

    Please sir upload on string

  • @cp65143
    @cp65143 5 месяцев назад +1

    Greedy: I am here to make profit not to enjoy my life😂

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

    Why you made your screen small please zoom it although I cant concentrate seriously looking at you😅

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

    First comment.. love from 🇨🇦

  • @AnchitaPanjeta
    @AnchitaPanjeta 4 месяца назад +1

    strings after this please

  • @nikhilpatidar9338
    @nikhilpatidar9338 5 месяцев назад +1

    Sir having a doubt not of this que
    I come through this problem many time as I try to run the code it executes and gives correct output for some case but sometimes submiting the code gives error at same test case with different output
    What actually is going on and how to handle it

    • @adnanbhat_
      @adnanbhat_ 4 месяца назад

      use Double in the comparitor function
      so what happens is assum we have val1 = 10 , 7 and val 2 = 10 , 6
      so it compares 10/7 , 10/6 becz in int type they both are 1 so it return 10/7 which is wrong but using double solves it .

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

    Striver bhai.. Plz add search bar in our website. Any problem I need to separately search in google tuf.. then in youtube tuf for video… tuf is my first preference for any dsa…

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

    brother pls upload the videos of string and stack queue

  • @Gg69696
    @Gg69696 5 месяцев назад +1

    is this the last video for greedy algorithms ??

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

    please upload video on java collections

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

    Stack means lifo and queue means fifo naa

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

    Two City Scheduling Please

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

    ❤❤❤❤

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

    Take this

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

    can anyone tell me why Unauthorised showing again and again after i login from my gmail account

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

    Striver bro do video on Huffman coding

  • @keshavsharma-fk1hb
    @keshavsharma-fk1hb 5 месяцев назад

    Please upload string videos

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

    Which notepad application are you using?

  • @souvikbasak4396
    @souvikbasak4396 4 месяца назад +3

    Striver a request, could you kindly provide a shorter playlist version for the binary search playlist as you said you would and as you have done for graphs and dp , as we have very less time for placements.

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

    can you please let me know the app that you are using for writing notes while explaining

  • @guru-lu5vn
    @guru-lu5vn 5 месяцев назад

    OPTIMAL SOLUTION $$
    class Solution {
    public:
    static bool comp(Item a, Item b){
    double r1 = (double) a.value/a.weight;
    double r2 = (double) b.value/b.weight;
    return r1>r2;
    }
    // Function to get the maximum total value in the knapsack.
    double fractionalKnapsack(int w, Item arr[], int n) {
    // Your code here
    double totalval=0;
    sort(arr,arr+n,comp);
    for(int i=0;i

  • @zyzzbrah9429
    @zyzzbrah9429 5 месяцев назад +1

    can anyone paste complete cpp code here

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

    Hi

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

    Who who who who who who

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

    us

  • @jalal-eddinelhachmi35
    @jalal-eddinelhachmi35 5 месяцев назад

    What is the name of the app he use?

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

    Look sandeep maheshwari greatest incentive ever than u

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

    U r trolled by me and my brother

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

    Baccho ka dsa

  • @SamsIt-hi9gf
    @SamsIt-hi9gf 5 месяцев назад

    class Solution {
    public:
    // Function to get the maximum total value in the knapsack.
    double fractionalKnapsack(int w, Item arr[], int n) {
    typedef pairpfi;
    priority_queuepq;
    for(int i = 0;i0&&pq.size()>0){
    auto it = pq.top();
    pq.pop();
    double vl = it.second.first;
    double wt = it.second.second;
    if(wt

  • @ishanmoykhede9484
    @ishanmoykhede9484 4 месяца назад +1

    broo where did your stack and queue playlist gone 🥲

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

    Who this rubbish sir

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @SibiRanganathL
    @SibiRanganathL 2 месяца назад

    understood

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +1

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +2

    Strings and stack queues after this please!

  • @parassingh3877
    @parassingh3877 5 месяцев назад +10

    Strings and stack queues after this please!