27.10.2013 Views

Space/time tradeoffs; dynamic programming - Framingham State ...

Space/time tradeoffs; dynamic programming - Framingham State ...

Space/time tradeoffs; dynamic programming - Framingham State ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6. <strong>Space</strong>-<strong>time</strong> <strong>tradeoffs</strong> and <strong>dynamic</strong> <strong>programming</strong><br />

B trees<br />

• Each node has m children<br />

• All data is stored in leaves<br />

• All leaves are at same tree level<br />

• Used to store very large indexes for<br />

databases stored on disk<br />

• Advantage: extremely short paths to<br />

leaves (lgmn) • Disadvantage: Wasted space<br />

David Keil Analysis of Algorithms 1/11<br />

2. Dynamic <strong>programming</strong><br />

• Some problems (e.g., Fibonacci) have<br />

overlapping subproblems<br />

• Dynamic <strong>programming</strong> suggests solving each<br />

subproblem only once and storing solution in a<br />

table for later reference<br />

• Cases:<br />

– Fibonacci<br />

– Binomial i i l coefficient ffi i<br />

– Warshall’s and Floyd’s algorithms (graphs)<br />

– Optimal BSTs<br />

– Knapsack problem<br />

David Keil Analysis of Algorithms 1/11<br />

D. Keil Analysis of Algorithms 1/11<br />

7<br />

8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!