DP vs Greedy what is dp (dynamic prgmming)

q. how dynamic prog works:
step 1 : breaks down the complex problm into simpler sub problem
step 2 : finds optimum soln to these sub problms
step 3 : store the results of sub problems ; this step is also known as memoization
step 4 : reuse them so that same sub problem is calculcated more than once
q. (very imp) applicable to problems which are having properties of
optimal sub structure : problem should be divisible
dynamic prog mei jab bhi recurssive approach aaye toh follow top down else jab itterative approach aaye toh follow bottom up
MULTISTAGE GRAPH:

there are two approach in multistage graph BACKWARD FORWARD
STAGE 1: start vertex=1→S d[1]/d[S]=0
STAGE 2: d(1,2)=1 d(1,3)=22 d(1,4)=77
Stage 3 :

