inorder traversal
dynamic programming