when choosing max of case 1: stealing the current element and continuing and case2: leaving the current element and continue, the max function will choose wether to steal or not and then continue.How will it work can you explain the recursion happening inside max using the example of the video.
Explanation for recursion happening inside max()
So first assume for 1 element
Ans=max(take a[0],leave a[0])
Now assume for 2 elements
Ans=max(A[1]+knapsack(1element) ,leave A[1]+knapsack(1element) )
See recursion of 2nd element involves recursion for 1 st element
And we can keep going like this