ÿþ<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=unicode"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 12"> <meta name=Originator content="Microsoft Word 12"> <link rel=File-List href="cmp251_files/filelist.xml"> <link rel=Edit-Time-Data href="cmp251_files/editdata.mso"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--> <title>class notes for cmp 251</title> <link rel=themeData href="cmp251_files/themedata.thmx"> <link rel=colorSchemeMapping href="cmp251_files/colorschememapping.xml"> <!--[if gte mso 9]><xml> <w:WordDocument> <w:TrackMoves>false</w:TrackMoves> <w:TrackFormatting/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF/> <w:LidThemeOther>EN-US</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:SplitPgBreakAndParaMark/> <w:DontVertAlignCellWithSp/> <w:DontBreakConstrainedForcedTables/> <w:DontVertAlignInTxbx/> <w:Word11KerningPairs/> <w:CachedColBalance/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin m:val="before"/> <m:brkBinSub m:val="&#45;-"/> <m:smallFrac m:val="off"/> <m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/> <m:defJc m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true" DefSemiHidden="true" DefQFormat="false" DefPriority="99" LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Normal"/> <w:LsdException Locked="false" Priority="9" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="heading 1"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/> <w:LsdException Locked="false" Priority="39" Name="toc 1"/> <w:LsdException Locked="false" Priority="39" Name="toc 2"/> <w:LsdException Locked="false" Priority="39" Name="toc 3"/> <w:LsdException Locked="false" Priority="39" Name="toc 4"/> <w:LsdException Locked="false" Priority="39" Name="toc 5"/> <w:LsdException Locked="false" Priority="39" Name="toc 6"/> <w:LsdException Locked="false" Priority="39" Name="toc 7"/> <w:LsdException Locked="false" Priority="39" Name="toc 8"/> <w:LsdException Locked="false" Priority="39" Name="toc 9"/> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/> <w:LsdException Locked="false" Priority="10" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Title"/> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/> <w:LsdException Locked="false" Priority="11" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/> <w:LsdException Locked="false" Priority="22" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Strong"/> <w:LsdException Locked="false" Priority="20" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/> <w:LsdException Locked="false" Priority="59" SemiHidden="false" UnhideWhenUsed="false" Name="Table Grid"/> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/> <w:LsdException Locked="false" Priority="1" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 1"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 1"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 1"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/> <w:LsdException Locked="false" Priority="34" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/> <w:LsdException Locked="false" Priority="29" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Quote"/> <w:LsdException Locked="false" Priority="30" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 1"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 1"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 2"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 2"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 2"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 2"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 2"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 3"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 3"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 3"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 3"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 3"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 4"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 4"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 4"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 4"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 4"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 5"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 5"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 5"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 5"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 5"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 6"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 6"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 6"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 6"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 6"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/> <w:LsdException Locked="false" Priority="19" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/> <w:LsdException Locked="false" Priority="21" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/> <w:LsdException Locked="false" Priority="31" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/> <w:LsdException Locked="false" Priority="32" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/> <w:LsdException Locked="false" Priority="33" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Book Title"/> <w:LsdException Locked="false" Priority="37" Name="Bibliography"/> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/> </w:LatentStyles> </xml><![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:1627400839 -2147483648 8 0 66047 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast;} p {mso-style-noshow:yes; mso-style-priority:99; mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast;} p.MsoAcetate, li.MsoAcetate, div.MsoAcetate {mso-style-noshow:yes; mso-style-priority:99; mso-style-link:"Balloon Text Char"; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:8.0pt; font-family:"Tahoma","sans-serif"; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast;} span.BalloonTextChar {mso-style-name:"Balloon Text Char"; mso-style-noshow:yes; mso-style-priority:99; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:"Balloon Text"; mso-ansi-font-size:8.0pt; mso-bidi-font-size:8.0pt; font-family:"Tahoma","sans-serif"; mso-ascii-font-family:Tahoma; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Tahoma; mso-bidi-font-family:Tahoma;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:112094099; mso-list-template-ids:1917459726;} @list l1 {mso-list-id:305085583; mso-list-template-ids:224966502;} @list l1:level1 {mso-level-number-format:alpha-lower; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l2 {mso-list-id:342898638; mso-list-template-ids:1152660462;} @list l3 {mso-list-id:677465587; mso-list-template-ids:346839900;} @list l4 {mso-list-id:698748483; mso-list-template-ids:-1091284868;} @list l4:level1 {mso-level-number-format:alpha-lower; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l5 {mso-list-id:708917297; mso-list-template-ids:-469884586;} @list l5:level2 {mso-level-number-format:alpha-lower; mso-level-tab-stop:1.0in; mso-level-number-position:left; text-indent:-.25in;} @list l6 {mso-list-id:856770915; mso-list-template-ids:1339049564;} @list l6:level1 {mso-level-number-format:alpha-lower; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l7 {mso-list-id:1132865438; mso-list-template-ids:1260421194;} @list l7:level1 {mso-level-number-format:alpha-lower; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l3:level1 lfo2 {mso-level-start-at:2;} @list l3:level1 lfo3 {mso-level-start-at:3;} @list l3:level1 lfo4 {mso-level-start-at:4;} @list l3:level1 lfo6 {mso-level-start-at:2;} @list l3:level1 lfo7 {mso-level-start-at:3;} @list l3:level1 lfo8 {mso-level-start-at:4;} @list l6:level1 lfo11 {mso-level-start-at:2;} @list l7:level1 lfo12 {mso-level-start-at:3;} @list l1:level1 lfo13 {mso-level-start-at:4;} @list l4:level1 lfo14 {mso-level-start-at:5;} @list l0:level1 lfo15 {mso-level-start-at:2;} @list l2:level1 lfo16 {mso-level-start-at:3;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="2050"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]--> </head> <body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'> <div class=Section1> <div style='border-width:100%'> <div> <div> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:17.0pt; font-family:"Calibri","sans-serif"'>1/22<o:p></o:p></span></p> </div> <div style='margin-top:2.75pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>Thursday, January 22, 2009<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>4:17 PM<o:p></o:p></span></p> </div> <div style='margin-left:15.7pt;margin-top:2.15pt'> <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"; mso-no-proof:yes'><!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1028" type="#_x0000_t75" style='width:436.5pt;height:310.5pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="cmp251_files/image001.png" o:title="image001"/> </v:shape><![endif]--><![if !vml]><img width=582 height=414 src="cmp251_files/image002.gif" v:shapes="Picture_x0020_1"><![endif]></span><span style='mso-fareast-font-family:"Times New Roman"'><o:p></o:p></span></p> </div> <div style='margin-left:87.7pt;margin-top:31.4pt'> <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"; mso-no-proof:yes'><!--[if gte vml 1]><v:shape id="Picture_x0020_2" o:spid="_x0000_i1027" type="#_x0000_t75" style='width:292.5pt;height:58.5pt;visibility:visible; mso-wrap-style:square'> <v:imagedata src="cmp251_files/image003.png" o:title="image002"/> </v:shape><![endif]--><![if !vml]><img width=390 height=78 src="cmp251_files/image004.gif" v:shapes="Picture_x0020_2"><![endif]></span><span style='mso-fareast-font-family:"Times New Roman"'><o:p></o:p></span></p> </div> </div> </div> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <div style='border-width:100%'> <div> <div> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:17.0pt; font-family:"Calibri","sans-serif"'>1/27<o:p></o:p></span></p> </div> <div style='margin-top:2.75pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>Tuesday, January 27, 2009<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>4:16 PM<o:p></o:p></span></p> </div> <div style='margin-top:22.4pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Project 1 due 2/12 midnight <o:p></o:p></span></p> </div> <div style='margin-top:33.7pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:14.0pt; font-family:"Calibri","sans-serif"'>Quiz write a recursive method of the Liked List Class that returns the last<span style='mso-spacerun:yes'>  </span>Negative Number in the list or 0 if there are no negative numbers in the list<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:14.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:14.0pt; font-family:"Calibri","sans-serif"'>/** Does quiz<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:14.0pt;font-family:"Calibri","sans-serif"'>@param first is the the first Link in the list that has a valid double in it <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:14.0pt; font-family:"Calibri","sans-serif"'>*/<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:14.0pt; font-family:"Calibri","sans-serif"'>Public double lastNegative(Link first)<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:14.0pt; font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:14.0pt;font-family:"Calibri","sans-serif"'>// base<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:14.0pt;font-family:"Calibri","sans-serif"'>If(null == first) return 0;<span style='mso-spacerun:yes'>  </span>// no negatives in an empty list<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:14.0pt;font-family:"Calibri","sans-serif"'>double last = lastNegative(first.next); // find the last negative In the rest<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:14.0pt;font-family:"Calibri","sans-serif"'>if(first.data &lt; 0 &amp;&amp; last ==0) return first.data;<span style='mso-spacerun:yes'>  </span>// first.data is the last negative number<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:14.0pt;font-family:"Calibri","sans-serif"'>return last; // either the last is in the rest or there are none<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:14.0pt; font-family:"Calibri","sans-serif"'>} // end lastNegative<o:p></o:p></span></p> </div> </div> </div> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <div style='border-width:100%'> <div> <div> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:17.0pt; font-family:"Calibri","sans-serif"'>2-3<o:p></o:p></span></p> </div> <div style='margin-top:2.75pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>Tuesday, February 03, 2009<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>4:06 PM<o:p></o:p></span></p> </div> <div style='margin-top:22.4pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>/** Does Quiz */<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Public int countNegativeNumbers()<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Return negativeNumberCount(contents.getNext());<span style='mso-spacerun:yes'>  </span>// use the first data bearing node<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>} // end countNegativeNumbers <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Private static int negativeNumberCount(Link first)<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>If(null == first) return 0;<span style='mso-spacerun:yes'>  </span>// nothing to count<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>If(first.getData()&lt;0) return 1+negativeNumberCount(first.getNext()); // found 1 more negative<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>// first.getData() is &gt;= 0<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Return negativeNumberCount(first.getNext()); // just need to count the rest<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>} // end negativeNumberCount<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Class RecursiveList implements Cloneable<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Protected Object firstData;<span style='mso-spacerun:yes'>  </span>// the first data item in the list<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Protected Boolean empty = true;<span style='mso-spacerun:yes'>  </span>// is the list empty<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Protected RecursiveList rest;<span style='mso-spacerun:yes'>  </span>// if the list is not empty it holds the rest of it.<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Public void push(Object toPush);<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Empty = false; // can't be empty after this<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Rest = clone();<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>FirstData = toPush;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>} // end<span style='mso-spacerun:yes'>  </span>push<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Public int length()<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>If(empty) return 0;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Return 1 + rest.length();<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>} // end length<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Public removeLast() throws EmptyException<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>If(empty) throw new EmptyException();<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>// check if only 1 item<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>If(rest.empty) { empty = true; rest=null; } <o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>Else rest.removeLast();<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>} //<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>} // end RecursiveList<o:p></o:p></span></p> </div> <div style='margin-top:77.4pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Behavior of</span><span style='font-size: 11.0pt;font-family:"Calibri","sans-serif"'> </span><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>algorithms over a set of data</span><span style='font-family:"Calibri","sans-serif"'><o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>Usually something like all lists of size n.<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>Worst case: for all inputs in the set which is slowest (consumes most)<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>Best case:<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>Average case:<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>Each of these is a function of n<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>Homework<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>Read pg 19-24 <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> </div> </div> </div> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <div style='border-width:100%'> <div> <div> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:17.0pt; font-family:"Calibri","sans-serif"'>2-5<o:p></o:p></span></p> </div> <div style='margin-top:2.75pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>Thursday, February 05, 2009<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>4:04 PM<o:p></o:p></span></p> </div> <div style='margin-top:22.4pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>/** does quiz */<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Public void removeRep()<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>// need 2 to repeat<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>If(empty()||rest.empty()) return;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>If(firstData.equals(rest.firstData))<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Rest = rest.rest; // remove repetition<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>removeRep();<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>}<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Else rest.removeRep();<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>} // end removeRep<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> </div> <div style='margin-top:58.55pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Worst consumes the most resources in the class indexed by n<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Best consumes the least & <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Average is the sum of the consumption divided by the number of elements <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Speed is the focus<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Depend on the algorithm not the hardware<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Pick an important operation and measure how many times we do it.<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>For searching almost always its object comparison<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Unsorted search of linked list<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>For( link searcher = contents.next; searcher != null; searcher = searcher.next)<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>If(searcher.data.matches(target)) return target;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Return null;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>If the list has n items in it <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Worst:<span style='mso-spacerun:yes'>  </span>n<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Best: 1<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Average:<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>c<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Cc<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Ccc<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Cccc<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>cccccccccccccccc<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>c<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>cc<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>ccc<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>cccc<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>ccccc<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>cddddd<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>ccdddd<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>cccddd<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>ccccdd<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Cccccd<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>6*5 size rectangle<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>6*5/2 size triangle<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>(n+1)*n/2 size triangle for list of size n<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>(n+1)/2<span style='mso-spacerun:yes'>  </span>is the number of comparisons for a linked list of size n <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Each row happens 1/n of the time<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Only if it always is in the list<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Relax that <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>p is the probability its in the list<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>p(n+1)/2 +(1-p)n<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>p=.8 n=100<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.8*(100+1)/2+(1-.8)*100 = 60.4<span style='mso-spacerun:yes'>   </span><o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'><span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> </div> </div> </div> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <div style='border-width:100%'> <div> <div> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:17.0pt; font-family:"Calibri","sans-serif"'>2-10<o:p></o:p></span></p> </div> <div style='margin-top:2.75pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>Tuesday, February 10, 2009<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>4:02 PM<o:p></o:p></span></p> </div> <div style='margin-top:22.4pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>/* Does Quiz */<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>public Comparable smallest()<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>If(empty) throw new Exception(&quot;Need an item to have a smallest&quot;);<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>If(rest.empty)<span style='mso-spacerun:yes'>  </span>// if 1 item it must be the smallest<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Return firstData;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Comparable small = rest.smallest(); // one candidate for smallest is the smallest of the rest<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>If(firstData.compareTo(small) &lt; 0) return firstData;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Return small;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>} // end smallest<o:p></o:p></span></p> </div> <div style='margin-top:26.95pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Report 1 due 2/26 midnight emailed<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Bulleted list<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Each idea has to address the whole question<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>List of size 100<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>But the first 10 occur 30% of the time<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>P = 80%<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Rest of the list is found 50% <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>20% is not in the list<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.03 a<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.03 aa<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.03 aaa<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.03 aaaa<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.03 aaaaa<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>& <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.03 aaaaaaaaaa<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>= 1.65<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.5/90 bbbbbbbbbbbdddddddddddddddddddd& .<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.5/90 bbbbbbbbbbbbddddddddddddddddddd& .<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.5/90 bbbbbbbbbbbbbdddddddddddddddddd& .<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.5/90 bbbbbbbbbbbbbb<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>= .5*111/2 = 27.75 <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>.2*100 = 20 <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>1.65+27.75+20 = 49.4 <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Cache of size c with probability r<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>r((1+c)/2) +(p-r)((c+1+n)/2) +(1-p)n<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> </div> </div> </div> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <div style='border-width:100%'> <div> <div> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:17.0pt; font-family:"Calibri","sans-serif"'>2/12<o:p></o:p></span></p> </div> <div style='margin-top:2.75pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>Thursday, February 12, 2009<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>3:59 PM<o:p></o:p></span></p> </div> <div style='margin-top:22.4pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>What is the average # of comparisons to find an item in a list of size 500 if you fail to find an item 25% of the item and the item is in the first 20<span style='mso-spacerun:yes'>    </span>10% of the time?<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:18.0pt; font-family:"Calibri","sans-serif"'>Show work<o:p></o:p></span></p> </div> <div style='margin-top:33.35pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>r(c+1)/2+(p-r)(n+c+1)/2+(1-p)n<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>N = 500<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>C = 20<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>P = .75<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>R = .1<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>.1*(20+1)/2+(.75-.1)*(500+20+1)/2+(1-.75)*500 = 295.375<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>p(n+1)/2+(1-p)n<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>.75*501/2+.25*500 = 312.875<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>.1*(5+1)/2+(.75-.1)*(500+5+1)/2+(1-.75)*500 = 289.75 <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>.3*(20+1)/2+(.75-.3)*(500+20+1)/2+(1-.75)*500 = 245.375 <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Sorted list<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Still all elements equally likely<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>So p(1+n)/2<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Assuming a linked list no binary search<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>You can fail faster<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>7, 13,201,369,978, 1038, & <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>You are searching for 50<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Need only 3 comparisons<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>1<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>22<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>333<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>4444<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>& <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>zzzzzzzzzzzz& z<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>nnnnnnnnn& n last is larger all the others smaller<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>nnnnnnnnn& n last is smaller<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Make a rectangle<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>NNNNNNNNNNNN& .N<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>NNNNNNNNNNNN& .N<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>1ZZZZZZZZZZZZZZZZ& Z<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>22YYYYYYYYYYYYYYY& Y<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>333XXXXXXXXXXXX& <span style='mso-spacerun:yes'>  </span>X<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>& <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>yyyyyyyyyyyyy& .<span style='mso-spacerun:yes'>     </span>y22<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>zzzzzzzzzzzzzzzz& .<span style='mso-spacerun:yes'>    </span>Zz1<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>nnnnnnnnnnnnn& ..<span style='mso-spacerun:yes'>  </span>nn<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>nnnnnnnnnnnnn& ..<span style='mso-spacerun:yes'>  </span>nn<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>(n(n+3)/2)/(n+1) = comparison (average) when we can't find an item in the sorted list<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>p(n+1)/2+(1-p)(n(n+3)/(2(n+1)))<span style='mso-spacerun:yes'>  </span>- sorted<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>p(n+1)/2+(1-p)n -<span style='mso-spacerun:yes'>  </span>unsorted<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>.75*(500+1)/2+.25*(500*503/(2*501)) = 250.6245 <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Unsorted size 100<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>.75*(100+1)/2+.25*100 = 62.875 <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>Sorted size 100<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>.75*(100+1)/2+.25*(100*103/(2*101)) = 50.6225 <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:16.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> </div> </div> </div> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <div style='border-width:100%'> <div> <div style='margin-left:27.45pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:17.0pt; font-family:"Calibri","sans-serif"'>2/24<o:p></o:p></span></p> </div> <div style='margin-left:27.45pt;margin-top:2.75pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>Tuesday, February 24, 2009<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>4:14 PM<o:p></o:p></span></p> </div> <div style='margin-top:22.4pt'> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.35pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Exam: 3/3<br> Project 2:<span style='mso-spacerun:yes'>  </span>3/12<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.35pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.35pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>p(n+1)/2+(1-p)(n(n+3)/(2(n+1)))<span style='mso-spacerun:yes'>  </span>- sorted<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.35pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>p(n+1)/2+(1-p)n -<span style='mso-spacerun:yes'>  </span>unsorted<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.35pt; margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p class=MsoNormal style='margin-left:27.35pt;text-indent:-.25in;mso-list:l3 level1 lfo1; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: Calibri;mso-bidi-font-family:Calibri'><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: "Times New Roman"'>p=.8 n=15000<br> .8*(15001/2)+(1-.8)*15000 = 9000.4 <o:p></o:p></span></p> <p class=MsoNormal style='margin-left:27.35pt;text-indent:-.25in;mso-list:l3 level1 lfo2; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: Calibri;mso-bidi-font-family:Calibri'><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: "Times New Roman"'>.8*(15001/2)+(1-.8)*(15000*15003/(2*15001)) = 7500.6 <o:p></o:p></span></p> <p class=MsoNormal style='margin-left:27.35pt;text-indent:-.25in;mso-list:l3 level1 lfo3; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: Calibri;mso-bidi-font-family:Calibri'><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: "Times New Roman"'>9000.4-7500.6<span style='mso-spacerun:yes'>  </span>= 1499.8 <o:p></o:p></span></p> <p class=MsoNormal style='margin-left:27.35pt;text-indent:-.25in;mso-list:l3 level1 lfo4; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: Calibri;mso-bidi-font-family:Calibri'><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: "Times New Roman"'>(1499.8/9000.4)*100 = 16.6637 <o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.35pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p class=MsoNormal style='margin-left:27.35pt;text-indent:-.25in;mso-list:l3 level1 lfo5; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: Calibri;mso-bidi-font-family:Calibri'><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: "Times New Roman"'>p=.2 n=15000<br> .2*(15001/2)+(1-.2)*15000 = 13500.1 <o:p></o:p></span></p> <p class=MsoNormal style='margin-left:27.35pt;text-indent:-.25in;mso-list:l3 level1 lfo6; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: Calibri;mso-bidi-font-family:Calibri'><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: "Times New Roman"'>.2*(15001/2)+(1-.2)*(15000*15003/(2*15001)) = 7500.8999 <o:p></o:p></span></p> <p class=MsoNormal style='margin-left:27.35pt;text-indent:-.25in;mso-list:l3 level1 lfo7; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: Calibri;mso-bidi-font-family:Calibri'><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: "Times New Roman"'>13500.1-7500.8999<span style='mso-spacerun:yes'>  </span>= 5999.2001<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></p> <p class=MsoNormal style='margin-left:27.35pt;text-indent:-.25in;mso-list:l3 level1 lfo8; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: Calibri;mso-bidi-font-family:Calibri'><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:16.0pt;font-family:"Calibri","sans-serif";mso-fareast-font-family: "Times New Roman"'>(5999.2001/13500.1)*100=44.4382 <o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.35pt; margin-bottom:.0001pt'><span style='font-size:16.0pt;font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> </div> <div style='margin-left:43.15pt;margin-top:32.05pt'> <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"; mso-no-proof:yes'><!--[if gte vml 1]><v:shape id="Picture_x0020_3" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:470.25pt;height:501pt;visibility:visible; mso-wrap-style:square'> <v:imagedata src="cmp251_files/image005.png" o:title="image003"/> </v:shape><![endif]--><![if !vml]><img width=627 height=668 src="cmp251_files/image006.gif" v:shapes="Picture_x0020_3"><![endif]></span><span style='mso-fareast-font-family:"Times New Roman"'><o:p></o:p></span></p> </div> <div style='margin-left:81.45pt;margin-top:3.1pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>...<o:p></o:p></span></p> </div> <div style='margin-left:63.45pt;margin-top:3.75pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>Each step is 1-q times the previous and 1 wider <o:p></o:p></span></p> </div> <div style='margin-left:61.5pt;margin-top:1.85pt'> <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"; mso-no-proof:yes'><!--[if gte vml 1]><v:shape id="Picture_x0020_4" o:spid="_x0000_i1025" type="#_x0000_t75" style='width:258pt;height:366pt;visibility:visible; mso-wrap-style:square'> <v:imagedata src="cmp251_files/image007.png" o:title="image004"/> </v:shape><![endif]--><![if !vml]><img width=344 height=488 src="cmp251_files/image008.gif" v:shapes="Picture_x0020_4"><![endif]></span><span style='mso-fareast-font-family:"Times New Roman"'><o:p></o:p></span></p> </div> </div> </div> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <div style='border-width:100%'> <div> <div> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:17.0pt; font-family:"Calibri","sans-serif"'>2/26 Review<o:p></o:p></span></p> </div> <div style='margin-top:2.75pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>Thursday, February 26, 2009<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:10.0pt; font-family:"Calibri","sans-serif";color:gray'>3:53 PM<o:p></o:p></span></p> </div> <div style='margin-top:22.4pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'><br> </span><b><span style='font-size:16.0pt;font-family:"Arial","sans-serif"'>Review CMP251 Exam 1.doc  </span></b><b><span style='font-size:20.0pt;font-family: "Arial","sans-serif"'>C</span></b><b><span style='font-size:16.0pt;font-family: "Arial","sans-serif"'> </span></b></p> <p style='margin:0in;margin-bottom:.0001pt'><b><span style='font-size:16.0pt; font-family:"Arial","sans-serif"'>February 09<o:p></o:p></span></b></p> <p class=MsoNormal style='margin-left:27.0pt;text-indent:-.25in;mso-list:l5 level1 lfo9; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><b><span style='mso-fareast-font-family:"Times New Roman"'>50 Pts:</span></b><span style='mso-fareast-font-family:"Times New Roman"'> <o:p></o:p></span></p> <p class=MsoNormal style='margin-left:.75in;text-indent:-.25in;mso-list:l5 level2 lfo10; tab-stops:list 1.0in;vertical-align:middle'><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>a.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='mso-fareast-font-family:"Times New Roman"'>If you had a linked list with 600 words in random order and searching it was successful 50% of the time what is the average number of comparisons to search the list? <o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'>.5*(600+1)/2+(1-.5)*600 = 450.25 </p> <p class=MsoNormal style='margin-left:.75in;text-indent:-.25in;mso-list:l6 level1 lfo11; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>b.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='mso-fareast-font-family:"Times New Roman"'>If you had a sorted linked list of 600 words and searching it was successful 50% of the time what is the average number of comparisons to search the list?<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'>.5*(600+1)/2+(1-.5)*(600*603)/(2*601) = 300.7492 </p> <p class=MsoNormal style='margin-left:.75in;text-indent:-.25in;mso-list:l7 level1 lfo12; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>c.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='mso-fareast-font-family:"Times New Roman"'>How much faster is the searching the sorted list than the unsorted list<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'>450.25 - 300.7492 = 149.5008 <br> 100*(450.25 - 300.7492)/450.25 = 33.204 %</p> <p class=MsoNormal style='margin-left:.75in;text-indent:-.25in;mso-list:l1 level1 lfo13; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>d.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='mso-fareast-font-family:"Times New Roman"'>If the first 30 items in the unsorted list are searched for 20% of the time how many comparisons are done on average.<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'>.2*(30+1)/2+.3*(31+600)/2+.5*600 = 397.75 </p> <p class=MsoNormal style='margin-left:.75in;text-indent:-.25in;mso-list:l4 level1 lfo14; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>e.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='mso-fareast-font-family:"Times New Roman"'>How much faster is searching the cached list than searching the unsorted list (part a).<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.75in; margin-bottom:.0001pt'>450.25-397.75<span style='mso-spacerun:yes'>  </span>= 52.5 <br> 100*52.5/450.25 = 11.6602 </p> <p class=MsoNormal style='margin-left:27.0pt;text-indent:-.25in;mso-list:l0 level1 lfo15; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><b><span style='mso-fareast-font-family:"Times New Roman"'>25 Pts:</span></b><span style='mso-fareast-font-family:"Times New Roman"'> If you are searching a list of size 1000 for an item that occurs 3% of the time how many comparisons are needed on average?<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'>&nbsp;</p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'>(1/.03)*(1-.97^1000) = 33.3333 </p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'>(1/.03)*(1-.97^10) = 8.7525 for list of size 10 </p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'>&nbsp;</p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'>&nbsp;</p> <p class=MsoNormal style='margin-left:27.0pt;text-indent:-.25in;mso-list:l2 level1 lfo16; tab-stops:list .5in;vertical-align:middle'><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><b><span style='mso-fareast-font-family:"Times New Roman"'>25 Pts:</span></b><span style='mso-fareast-font-family:"Times New Roman"'> What does the method named recurse return when ReviewRecurse is the list of strings:  alpha ,  beta ,  gamma ,  delta <br> public class ReviewRecurse<br> {<br> private String firstItem;<br> private ReviewRecurse rest;<br> private Boolean isEmpty = true;<br> public String recurse()<br> {<br> <span style='mso-spacerun:yes'>      </span>if(isEmpty) return  gurgle ;<br> <span style='mso-spacerun:yes'>      </span>return rest.recurse()+ :  +firstItem;<br> } // end recurse<br> & <br> } // end ToRecurse<br> (alpha (beta (gama (delta ()))) is the list<br> ()<span style='mso-spacerun:yes'>  </span>- gurgle<br> (delta ()) - gurgle : delta<br> (gamma (delta ()))<span style='mso-spacerun:yes'>  </span>- gurgle : delta : gamma<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'>...<br> Answer : gurgle : delta : gamma : beta : alpha</p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> <p style='margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:27.0pt; margin-bottom:.0001pt'><span style='font-size:8.0pt;font-family:"Tahoma","sans-serif"; color:#666666'>Pasted from &lt;<a href="../cmp251/CMP251%20Exam%201.doc">file:///J:\CLASS\Spring09\cmp251\CMP251%20Exam%201.doc</a>&gt; <o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>&nbsp;<o:p></o:p></span></p> </div> <div style='margin-top:31.9pt'> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>New Topic:<o:p></o:p></span></p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt; font-family:"Calibri","sans-serif"'>O -notation<o:p></o:p></span></p> </div> </div> </div> <div> <p style='margin:0in;margin-bottom:.0001pt'>&nbsp;</p> <p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:9.0pt; font-family:"Arial","sans-serif";color:#969696'>Created with Microsoft Office OneNote 2007<br> One place for all your notes and information<o:p></o:p></span></p> </div> </div> </body> </html>