(Box[] boxes, Box bottom)
| 17 | } |
| 18 | |
| 19 | public static ArrayList<Box> createStackR(Box[] boxes, Box bottom) { |
| 20 | int max_height = 0; |
| 21 | ArrayList<Box> max_stack = null; |
| 22 | for (int i = 0; i < boxes.length; i++) { |
| 23 | if (boxes[i].canBeAbove(bottom)) { |
| 24 | ArrayList<Box> new_stack = createStackR(boxes, boxes[i]); |
| 25 | int new_height = stackHeight(new_stack); |
| 26 | if (new_height > max_height) { |
| 27 | max_stack = new_stack; |
| 28 | max_height = new_height; |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | if (max_stack == null) { |
| 34 | max_stack = new ArrayList<Box>(); |
| 35 | } |
| 36 | if (bottom != null) { |
| 37 | max_stack.add(0, bottom); |
| 38 | } |
| 39 | |
| 40 | return max_stack; |
| 41 | } |
| 42 | |
| 43 | public static ArrayList<Box> createStackDP(Box[] boxes, Box bottom, HashMap<Box, ArrayList<Box>> stack_map) { |
| 44 | if (bottom != null && stack_map.containsKey(bottom)) { |
nothing calls this directly
no test coverage detected