i dont understand the answer ,plz help
Doubt on greedy algo
For a problem that can be solved using DP and Greedy. Answer is O(memory) (DP)>= O(memory) (Greedy) && O(time) (DP)>= O(time) (Greedy) .plz explain it
dp compute and store answer of all valid possibilities and because of that it needs more space and time.
whereas in greedy instead of trying all possibilities we only pick local optimal thats why it takes comparatively less time and space
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.