IN THIS HOW INCLUCDE AND EXCLUDE VARIABLE WORK?
KNAPSACH PROBLEM
See the difference in both function calls for these.
While excluding you keep the available capacity for next item same as before, but in include you reduce by weight of item i. This stems from the fact that you can either select an item or not select it. Function just returns the maximum of these 2
hpw recursion worls here I am not able to deduce a recursion tree
You can try seeing this https://www.youtube.com/watch?v=ntCGbPMeqgg or this https://www.youtube.com/watch?v=T4bY72lCQac
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.