CSC375 Homework8 George Corser 2009-03-25

CSC375 Homework8 George Corser 2009-03-25 - CSC 375...

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

View Full Document Right Arrow Icon
CSC 375 Homework 8 George Corser 2009 March 25 5.9 Overhead fractions for full binary tree implementations: (a) 75% (data uses 4 bytes, pointers use 12; overhead is 12/16). (b) 33.3% (data uses 16 bytes, pointers use 8; overhead is 8/24). (c) Internal nodes have 20 bytes (12 overhead) and leaf nodes have 12 bytes (4 overhead). Full binary trees have n internal nodes and n+1 leaf nodes, and consume 20n + 12(n+1) bytes, which are 32n+12 total bytes. Overhead is 12n + 4(n+1) bytes, or 16n+4 overhead bytes. To compute the overhead fraction, divide the latter by the former: 12 32n 4 16n + + = 3 8n 1 4n + + . As n approaches infinity, the overhead fraction approaches 50%. (d) Internal nodes have 8 bytes (8 overhead) and leaf nodes have 4 bytes (0 overhead). Full binary trees have n internal nodes and n+1 leaf nodes, and consume 8n + 4(n+1) bytes, which are 12n+4 total bytes. Overhead is 8n + 0(n+1) bytes, or 8n total overhead bytes. To compute the overhead fraction, divide the latter by the former: 4 12n 8n + = 1 3n 2n + . As n approaches infinity, the overhead fraction approaches 2/3, or 66.7%. 5.10
Background image of page 1

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

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

Page1 / 4

CSC375 Homework8 George Corser 2009-03-25 - CSC 375...

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

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