Course Hero Logo

October 26 2005 copyright 2001 5 by erik d demaine

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 448 - 456 out of 773 pages.

October 26, 2005Copyright © 2001-5 by Erik D. Demaine and Charles E. LeisersonL11.26Proof of theoremTHEOREM:With high probability, every searchin ann-element skip list costsO(lgn)COOLIDEA:Analyze search backwards—leaf to rootSearch starts [ends] at leaf (node in bottom level)At each node visited:– If node wasn’t promoted higher (gotTAILShere),then we go [came from] left– If node was promoted higher (gotHEADShere),then we go [came from] upSearch stops [starts] at the root (or−∞)
October 26, 2005Copyright © 2001-5 by Erik D. Demaine and Charles E. LeisersonL11.27Proof of theoremTHEOREM:With high probability, every searchin ann-element skip list costsO(lgn)COOLIDEA:Analyze search backwards—leaf to rootPROOF:Search makes “up” and “left” movesuntil it reaches the root (or−∞)Number of “up” moves<number of levelsclgnw.h.p.(Lemma)w.h.p., number of moves is at most the numberof times we need to flip a coin to getclgnHEADs
October 26, 2005Copyright © 2001-5 by Erik D. Demaine and Charles E. LeisersonL11.28Coin flipping analysisCLAIM:Number of coin flips untilclgnHEADs=Θ(lgn)with high probabilityPROOF:ObviouslyΩ(lgn): at leastclgnProveO(lgn)“by example”:Say we make10clgnflipsWhen are there at leastclgnHEADs?(Later generalize to arbitrary values of10)
October 26, 2005Copyright © 2001-5 by Erik D. Demaine and Charles E. LeisersonL11.29Coin flipping analysisCLAIM:Number of coin flips untilclgnHEADs=Θ(lgn)with high probabilityPROOF:• Pr{exactlyclgnHEADs} =Pr{at mostclgnHEADs}ncncncnclg9lg2121lglg10ordersHEADsTAILsncncnclg921lglg10overestimateon ordersTAILs
October 26, 2005Copyright © 2001-5 by Erik D. Demaine and Charles E. LeisersonL11.30Coin flipping analysis (cont’d)Recall bounds on:Pr{at mostclgnHEADs}ncncnclg921lglg10xyxxxyexyxyncncncncelg9lg21lglg10()ncncelg9lg210=ncncelg9lg)10lg(22=ncelg]9)10[lg(2=αn/1=for[]ce=)10lg(9α
October 26, 2005Copyright © 2001-5 by Erik D. Demaine and Charles E. LeisersonL11.31Coin flipping analysis (cont’d)Pr{at mostclgnHEADs}≤ 1/nαforα= [9−lg(10e)]cKEYPROPERTY:α→ ∞as10 → ∞, for anycSo set10, i.e., constant inO(lgn)bound,large enough to meet desiredαThis completes the proof of the coin-flipping claimand the proof of the theorem.
October 31, 2005Copyright © 2001-5 by Erik D. Demaine and Charles E. LeisersonL13.1Prof. Charles E. LeisersonLECTURE13Amortized AnalysisDynamic tablesAggregate methodAccounting methodPotential methodIntroduction to Algorithms6.046J/18.401J
October 31, 2005Copyright © 2001-5 by Erik D. Demaine and Charles E. LeisersonL13.2How large should a hashtable be?Problem:What if we don’t know the proper sizein advance?Goal:Make the table as small as possible, butlarge enough so that it won’t overflow (orotherwise become inefficient).

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 773 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
N/A
Tags
Algorithms, Insertion Sort, Divide and conquer algorithm, Charles E Leiserson, Prof Erik D Demaine

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture