<span>public void myMethod(int w, int y, int z) {
</span>int a, b, c, d, e, f, g, h, i, j, k, l;
<span>a = w * z; </span>b = w * z + y; c = w * -z; d = w * --z + y++; e = w * z-- + ++y<span> ; </span>f = w + z * y; g = w – y + z; h = (w + y) * z; i = y / w; j = y / z; k = w % y; <span>l = y % w; </span>System.out.println( "%d %d %d %d %d %d %d %d %d %d %d %d", a,b,c,d,e,f,g,h,i,j,k); }
In general dynamic programming is a divide and conquer strategy which can be implemented using bottom up approach or top down approach.
Bottom-up approach in dynamic programming will solve a relatively simple sub-problem first and then use the solution to build and arrive at solutions to a bigger sub-problem.
Top down approach is reversed to bottom-up approach and is also known as Memoization Method. Instead of solving a problem started from the base state sub-problem, the top down approach break a problem into a smaller problems from the top most destination state until it reaches the bottom most base state.