Difference between revisions of "CSC231 Final Exam Solutoins 2012"
(Created page with "--~~~~ ---- <onlysmith> This is just a sketch of the solution for the exam, but enough to give you an idea of what you had to do. =Problem 1= * for the compression ratio, an ...") |
|||
Line 73: | Line 73: | ||
* 255 times (''n''+2) characters, as in (xxx): 255 * (''n''+2) | * 255 times (''n''+2) characters, as in (xxx): 255 * (''n''+2) | ||
* compressed version: 255 1 xxx...x, or 2 + ''n'' bytes. | * compressed version: 255 1 xxx...x, or 2 + ''n'' bytes. | ||
− | * | + | * ratio = (''n''+2) / ( 255 * (''n''+2 ) ) = 1/255 = 0.4% |
If we had two such lines, the compression ratio would be (''n''+2 + ''n''+2) / ( 255 * (''n''+2) + 255 *(''n''+2 ) ) which is still 0.4%. | If we had two such lines, the compression ratio would be (''n''+2 + ''n''+2) / ( 255 * (''n''+2) + 255 *(''n''+2 ) ) which is still 0.4%. |
Revision as of 14:38, 20 December 2012
--D. Thiebaut 14:37, 20 December 2012 (EST)