I am working on understanding this problem:
You are given a rectangular piece of cloth with dimensions X by Y, where X and Y are positive integers, and a list of n products that can be made using the cloth. For each product i in [1,n] you know that a rectangle of cloth of dimensions ai by bi is needed and that the final selling price of the product is ci. Assume that ai, bi, and ci are all positive integers. You have a machine that can cut any rectangular piece of cloth into two pieces either horizontally or vertically. Design an algorithm that finds the best strategy for cutting an X by Y piece of cloth so that the products made from the resulting pieces give the maximum sum of selling prices. You are free to make as many copies of a given product as you wish, or none if desired.
Although I've actually already properly implemented the dynamic programming solution, I am having a hard time understanding / proving why a naive solution to the problem runs in exponential time. I think this indicates some lack of understanding of exponential algorithms in the first place but I'm mostly concerned with it in the case above for now.
I understand that the dynamic programming solution allows me to save work by memoizing the work that I've already done. The runtime with dynamic programming is supposed to be O((W*H)(n+w+h)) or O(n^3)/polynomial. This is because I am trying each possible width and height of cloth piece. And for each possible width and height of cloth piece I try each possible vertical, horizontal, and piece sized cut. (I'm also a bit confused why n is necessary in the time complexity though because if you try every possible horizontal and vertical cut that should also try every possible piece).
If I turned memoization off, that should give me the brute force method and that involves solving the entire tree. This is supposed to be polynomial or O(2^n). Why? Isn't an algorithm with O(2^n) time complexity supposed to be representable by a binary tree? It seems like a naive solution to this problem wouldn't be binary.
O(2^n). - phs