rec21 - 6.006 Intro to Algorithms Recitation 21 April 27,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 6.006 Intro to Algorithms Recitation 21 April 27, 2011 Dynamic Programming: Widget Layout Setup There are two types of widgets. • A leaf widget is a visible widget that someone may see or use, such as a button or an image. Every leaf widget has a list of possible rectangular sizes it can be presented as. For example, a button leaf widget may be a rectangle size 3 × 1, 4 × 2, or 6 × 4. • An internal widget is a rectangular container that contains widgets inside of it. It may contain a combination of leaf widgets and other internal widgets (may be referred to as children widgets). Widgets may be arranged horizontally or vertically within the internal widget. The size of an internal widget must be large enough to contain all the widgets inside of it (e.g. with a horizontal orientation, width of internal widget is the sum of the widths of the widgets inside and height of internal widget is the maximum height of the widgets inside). In the widget layout problem, our goal is to fit widgets into a rectangular screen of size W × H given a hierarchy of widgets. A hierarchy of widgets defines which widgets are contained within which widgets and in what order. It does not state the orientation of the internal widgets or which size of the legal sizes of a leaf widget we choose. We are free to vary the orientation or the sizes of the leaf widgets to try to fit all the widgets in some rectangular screen size W × H . Note that the hierarchy of widgets can be represented as a tree where the non-leaf nodes are internal widgets and the leaf nodes are leaf widgets. The root of the tree represents the internal widget that contains everything. We are deciding if this root widget can be contained in a rectangle size W × H . 6.006 Intro to Algorithms Recitation 21 April 27, 2011 Defining Subproblems This is a more complex dynamic programming problem with multiple types of widgets and several factors needed to be taken account. In the end though, there are two types of guesses that we’re making. For each leaf widget, we need to choose a size from its list of acceptable sizes. For each internal widget, we need to choose the orientation of its children widgets. Once an internal widget’s orientation and children sizes have been set, we can calculate the size of the internal widget by packing all the children together as tightly as possible.widget by packing all the children together as tightly as possible....
View Full Document

This note was uploaded on 11/11/2011 for the course MATH 180 taught by Professor Byrns during the Spring '11 term at Montgomery College.

Page1 / 6

rec21 - 6.006 Intro to Algorithms Recitation 21 April 27,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online