Self-Organizing Lists1 Self-Organizing Lists Competitive Analysis Lee Wee Sun SoC1 5-26 Modified by Orgad Keller Modified again by.

Slides:



Advertisements
Similar presentations
CSE 4101/5101 Prof. Andy Mirzaian. Lists Move-to-Front Search Trees Binary Search Trees Multi-Way Search Trees B-trees Splay Trees Trees Red-Black.
Advertisements

Parameterized Matching Amir, Farach, Muthukrishnan Orgad Keller Modified by Ariel Rosenfeld.
Congestion Games with Player- Specific Payoff Functions Igal Milchtaich, Department of Mathematics, The Hebrew University of Jerusalem, 1993 Presentation.
On the Competitiveness of Self Organizing Linear Search J. Ian Munro (University of Waterloo) Competitiveness: How well does an on line algorithm do in.
Lower bound for sorting, radix sort COMP171 Fall 2005.
Bounds on Code Length Theorem: Let l ∗ 1, l ∗ 2,..., l ∗ m be optimal codeword lengths for a source distribution p and a D-ary alphabet, and let L ∗ be.
Princeton University COS 423 Theory of Algorithms Spring 2001 Kevin Wayne Competitive Analysis.
Introduction to Algorithms Jiafen Liu Sept
CSC 2300 Data Structures & Algorithms March 16, 2007 Chapter 7. Sorting.
Introduction to Algorithms 6.046J/18.401J L ECTURE 14 Competitive Analysis  Self-organizing lists  Move-to-front heuristic  Competitive analysis of.
2007/3/6 1 Online Chasing Problems for Regular n-gons Hiroshi Fujiwara* Kazuo Iwama Kouki Yonezawa.
Evaluation of Algorithms for the List Update Problem Suporn Pongnumkul R. Ravi Kedar Dhamdhere.
UMass Lowell Computer Science Graduate Analysis of Algorithms Prof. Karen Daniels Spring, 2010 Lecture 3 Tuesday, 2/9/10 Amortized Analysis.
Lower bound for sorting, radix sort COMP171 Fall 2006.
UMass Lowell Computer Science Graduate Analysis of Algorithms Prof. Karen Daniels Spring, 2005 Lecture 3 Tuesday, 2/8/05 Amortized Analysis.
CSC 2300 Data Structures & Algorithms March 27, 2007 Chapter 7. Sorting.
Tirgul 9 Amortized analysis Graph representation.
UMass Lowell Computer Science Graduate Analysis of Algorithms Prof. Karen Daniels Spring, 2009 Lecture 3 Tuesday, 2/10/09 Amortized Analysis.
Online Algorithms Motivation and Definitions Paging Problem Competitive Analysis Online Load Balancing.
Shuchi Chawla, Carnegie Mellon University Static Optimality and Dynamic Search Optimality in Lists and Trees Avrim Blum Shuchi Chawla Adam Kalai 1/6/2002.
CSE 421 Algorithms Richard Anderson Lecture 6 Greedy Algorithms.
Randomized Competitive Analysis for Two Server Problems Wolfgang Bein Kazuo Iwama Jun Kawahara.
Lecture 10: Search Structures and Hashing
Evaluation of Algorithms for the List Update Problem Suporn Pongnumkul R. Ravi Kedar Dhamdhere.
Competitive Analysis of Incentive Compatible On-Line Auctions Ron Lavi and Noam Nisan SISL/IST, Cal-Tech Hebrew University.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 5 Linear-time sorting Can we do better than comparison sorting? Linear-time sorting.
Orgad Keller Modified by Ariel Rosenfeld Less Than Matching.
Binary search trees Definition Binary search trees and dynamic set operations Balanced binary search trees –Tree rotations –Red-black trees Move to front.
CS 202, Spring 2003 Fundamental Structures of Computer Science II Bilkent University1 Sorting CS 202 – Fundamental Structures of Computer Science II Bilkent.
Online Algorithms Lecture notes for lectures given by Dr. Ely Porat, Bar-Ilan University Notes taken by: Navot Akiva Yair Kaufman Raz Lin Ohad Lipsky July.
0 Course Outline n Introduction and Algorithm Analysis (Ch. 2) n Hash Tables: dictionary data structure (Ch. 5) n Heaps: priority queue data structures.
Mathematical Maxims and Minims, 1988
CS 473Lecture 121 CS473-Algorithms I Lecture 12 Amortized Analysis.
Great Theoretical Ideas in Computer Science.
Online Paging Algorithm By: Puneet C. Jain Bhaskar C. Chawda Yashu Gupta Supervisor: Dr. Naveen Garg, Dr. Kavitha Telikepalli.
1 Summary of lectures 1.Introduction to Algorithm Analysis and Design (Chapter 1-3). Lecture SlidesLecture Slides 2.Recurrence and Master Theorem (Chapter.
Randomized Online Algorithm for Minimum Metric Bipartite Matching Adam Meyerson UCLA.
Online Algorithms. Introduction An offline algorithm has a full information in advance so it can compute the optimal strategy to maximize its profit (minimize.
Competitive Queue Policies for Differentiated Services Seminar in Packet Networks1 Competitive Queue Policies for Differentiated Services William.
A Universal Turing Machine
Disjoint Sets Data Structure (Chap. 21) A disjoint-set is a collection  ={S 1, S 2,…, S k } of distinct dynamic sets. Each set is identified by a member.
Advanced Algorithm Design and Analysis (Lecture 12) SW5 fall 2004 Simonas Šaltenis E1-215b
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 7.
1 Medians and Order Statistics CLRS Chapter 9. upper median lower median The lower median is the -th order statistic The upper median.
A Optimal On-line Algorithm for k Servers on Trees Author : Marek Chrobak Lawrence L. Larmore 報告人:羅正偉.
© The McGraw-Hill Companies, Inc., Chapter 12 On-Line Algorithms.
Chapter 3 The easy stuff. Lists If you only need to store a few things, the simplest and easiest approach might be to put them in a list Only if you need.
1 Self-Organizing Linked List. 2 Motivation Searching for an element in a linked list takes O(N) worst case time –If we are lucky, and the element is.
Introduction to Algorithms Amortized Analysis My T. UF.
11 -1 Chapter 12 On-Line Algorithms On-Line Algorithms On-line algorithms are used to solve on-line problems. The disk scheduling problem The requests.
Amortized Analysis In amortized analysis, the time required to perform a sequence of operations is averaged over all the operations performed Aggregate.
CSE 421 Algorithms Richard Anderson Lecture 8 Greedy Algorithms: Homework Scheduling and Optimal Caching.
CSE 5314 – Spring 2004 Homework #1 - Solutions [Soumya Sanyal] Q 1.5: Prove that the algorithm “MTF every-other-access” (i.e. move the item to the front.
Computer Sciences Department1. Sorting algorithm 4 Computer Sciences Department3.
Theory of Computational Complexity M1 Takao Inoshita Iwama & Ito Lab Graduate School of Informatics, Kyoto University.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
Binary search trees Definition
Self-Adjusting Search trees
Better Algorithms for Better Computers
Static Optimality and Dynamic Search Optimality in Lists and Trees
Pattern Matching With Don’t Cares Clifford & Clifford’s Algorithm
Richard Anderson Autumn 2015 Lecture 8 – Greedy Algorithms II
Greedy Algorithms: Homework Scheduling and Optimal Caching
Polynomial time approximation scheme
Course: Data Structures Lecturer: Uri Zwick March 2008
Richard Anderson Winter 2019 Lecture 8 – Greedy Algorithms II
Richard Anderson Autumn 2016 Lecture 8 – Greedy Algorithms II
Disjoint Sets Data Structure (Chap. 21)
Sorting Sorting is a fundamental problem in computer science.
Richard Anderson Autumn 2019 Lecture 8 – Greedy Algorithms II
Presentation transcript:

Self-Organizing Lists1 Self-Organizing Lists Competitive Analysis Lee Wee Sun SoC Modified by Orgad Keller Modified again by Ariel Rosenfeld

Self-Organizing Lists2 Self-Organizing List List L of n elements –Operations Access(x) cost rank(x)=position of x in the list –L can be reordered by transposing adjacent elements – cost = 1.

Self-Organizing Lists3 On-line Problem Problem: Sequence S of operations to which the algorithm must respond to without knowing the future inputs. Goal: Minimize the total cost of responding to the operations

Self-Organizing Lists4 Analysis Worst case: –Adversary can always access the tail element of L –Cost: in worst case Average case: –Suppose element x is accessed with a probability of p(x) Minimized when L sorted in decreasing order WRT p. –Keep count of #times the element is accessed and maintain a list in order to decrease count.

Self-Organizing Lists5 Heuristic Move to Front (MTF): –After accessing x, move x to head of L (by transposes) Cost is –Responds well to locality in access pattern.

Self-Organizing Lists6 Competitive analysis An online algorithm A is  -competitive if there exists a constant k such that for any sequence S of operations is the algorithm that performs optimally for that particular sequence –Knows the whole sequence in advance and has infinite computation power to find the method for achieving the optimal cost.

Self-Organizing Lists7 MTF is competitive Theorem: MTF is 4-competitive for self-organizing lists. Proof: –Let L i be MTF’s list after i-th access. –Let L i * be OPT’s list after i-th access –Let c i = MTF’s cost for i-th operation –Let c i * = OPT’s cost for the i-th operation = rank*(x) + t i if OPT performs t i transposes

Self-Organizing Lists8 –Define potential function by x preceded y in L i and y precedes x in L i * = #inversions Example: –L i = –L i * = – |{(E,C),(E,A),(E,D),(E,B),(D,B)| = 10 Note: – for every i – if MTF and OPT have the same list

Self-Organizing Lists9 –How much does change in 1 transpose? Transpose either creates or destroys 1 inversion – –Let = amortized cost WRT of MTF for the i-th operation –Note (#inversions created - #inversions destroyed).

Self-Organizing Lists10 –Let’s Assume: (We’ll prove this later). Then:

Self-Organizing Lists11 –A = elements preceding x in L i-1 and preceding x in L i-1 * –B = elements preceding x in L i-1 and following x in L i-1 * –C = elements following x in L i-1 and preceding x in L i-1 * –D = elements following x in L i-1 and following x in L i-1 * A  B x C  D r = rank(x) = |A| + |B| + 1 A  C x B  D r* = rank*(x)  |A| + 1 L i-1 : L i-1 *: why ?

Self-Organizing Lists12 –When x is moved to front # inversions created = |A| # inversions destroyed = |B| –Each transpose by OPT creates  1 inversions  Transposes by OPT Actual cost by OPT

Self-Organizing Lists13 If we count transposes that move x towards the front as “free”, then MTF is 2-competitive (see Sleator and Tarjan) What if L 0  L 0 *? – might be  (n 2 ) –COST MTF (S)  4COST OPT (S) +  (n 2 ) Still 4-competitive

Self-Organizing Lists14 Summary Definition of competitive analysis – MTF is competitive for self organizing lists –Potential function method Number of inversions with the OPT’s list is the potential.