Introduction - CSE 4101/5101 Prof Andy Mirzaian Advanced...

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

View Full Document Right Arrow Icon
CSE 4101/5101 Advanced Data Structures Prof. Andy Mirzaian
Background image of page 1

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

View Full DocumentRight Arrow Icon
Course Overview www.cse.yorku.ca/~andy/courses/4101 2
Background image of page 2
COURSE THEMES q Amortized Analysis q Self Adjusting Data Structures q Competitive On-Line Algorithms q Algorithmic Applications 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
COURSE TOPICS Phase I: Data Structures § Dictionaries § Priority Queues § Disjoint Set Union Phase II: Algorithmics § Computational Geometry § Approximation Algorithms 4
Background image of page 4
INTRODUCTION Ø Amortization Ø Self Adjustment Ø Competitiveness References: [CLRS] chapter 17 Lecture Note 1 (and parts of LN11) 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
Amortization 6
Background image of page 6
Data Structure Analysis Methods q What is the total computational time to execute a sequence of operations on a data structure? - These operations have correlated effect on the DS q Worst-Case Analysis: - worst-case time per operation  number of operations - ignores the correlated effects on the DS - this upper-bound is most often too pessimistic q Expected-Case Analysis: - needs probability distribution - probabilistic assumptions may not correspond to reality - does not give upper-bound q Amortized Analysis: - simple and robust - correlated effects are taken into account 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
Amortized Analysis § amortized time = average time of an operation over a worst-case sequence of operations. § a sequence of n operations s = (op1 , op2 , … , opn ) on the data structure (starting from some given initial state) § actual time costs per op in the sequence: c1 , c2 , … , cn § total time over the sequence: c1 + c2 + … + cn § worst-case total: T(n) = max s (c1 + c2 + … + cn) § amortized time is (a good upper bound on) T(n)/n § Three Methods of Amortized Analysis: - Aggregate Method: T(n)/n - Accounting Method: a banker’s point of view - Potential Function Method: a physicist’s point of view 8
Background image of page 8
Two running D.S. examples 1. Stack with Multipop: - A sequence of n intermixed Push(x,S), Pop(S), Multipop(S) operations on an initially empty stack S - Multipop example: while S  and Top(S)<0 do Pop(S) - time cost unit = O(1) per Push and Pop - worst-case actual cost of a single Multipop = O(n) - B-bit Binary Counter A= AB-1…A2A1A0 - initially all 0 bits - procedure Increment(A) i0 while i<B and Ai=1 do Ai0 ; i++ end-while if i<B then Ai1 end - time cost unit = O(1) per bit-flip - worst-case actual cost of a single Increment = O(B) 0000000 0000001 0000010 0000011 0000100 0000101 0000110 0000111 0001000 2. Binary Counter with Increment operation: 9
Background image of page 9

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

View Full DocumentRight Arrow Icon
Aggregate Method: Stack with Multipop Amortized Analysis: Correlation: Each Pop (including those in Multipops) corresponds to a previously pushed item. # Pops < # Pushes < n. T(n)  2n. amortized cost per operation = T(n)/n 2 = O(1). Worst-case Analysis: n operations. worst-case per operation = O(n).
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2012 for the course CSE 4101 taught by Professor Mirzaian during the Winter '12 term at York University.

Page1 / 53

Introduction - CSE 4101/5101 Prof Andy Mirzaian Advanced...

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

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