Introduction

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

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

CSE 4101/5101 Advanced Data Structures Prof. Andy Mirzaian

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

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

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

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

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

View Full Document
Amortization 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

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

View Full Document
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
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

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

View Full Document
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).
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
Ask a homework question - tutors are online