bottomup approach (iterative) done