MF - CSE 4101/5101 Prof. Andy Mirzaian Move to Front Self...

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

View Full Document Right Arrow Icon
CSE 4101/5101 Move to Front Self Adjusting Linear Lists 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
Lists Move-to-Front Search Trees Binary Search Trees Multi-Way Search Trees B-trees Splay Trees 2-3-4 Trees Red-Black Trees SELF ADJUSTING WORST-CASE EFFICIENT competitive competitive? Linear Lists Multi-Lists Hash Tables DICTIONARIES 2
Background image of page 2
TOPICS in this slide Ø Linear List with Move-to-Front Ø Competitiveness of Move-to-Front: § Static Dictionary § Dynamic Dictionary § Expected Case 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
References: Lecture Note 2 4
Background image of page 4
Move-to-Front 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
Introduction § s = a sequence of m dictionary operations. § We usually assume D is initially empty (except for static dictionaries, i.e., search only). § We often assume there is a linear ordering defined on keys (e.g., integers) so that we can make key comparisons. § D as a SEQUENTIAL LINEAR LIST: We need i probes to sequentially access the item at position i on list D. § SELF-ADJUSTING FEATURE: Exchange: swap the positions of a pair of adjacent items on D. Free exchange: exchanging the accessed/inserted item with its preceding item on D. Paid exchange: all other types of exchanges. Costs: 1 for each item probe 1 for each paid exchange 0 for each free exchange § DICTIONARY: Maintain a set D of items (each with a unique identifier called key ) that supports the following three operations: Search (x, D): Locate item x in D (also called access ) Insert (x, D): Insert item x in D (no duplicate keys) Delete (x, D): Delete item x from D 6
Background image of page 6
Some on-line heuristics § Move-to-Front (MF): After each dictionary operation perform maximum number of free exchanges (no paid exchanges). This moves the accessed/inserted item to the front of the list without affecting the relative order of the other items on the list. § Transpose (T): After each dictionary operation perform one free exchange if possible (no paid exchanges). This moves the accessed/inserted item one position closer to the front (if not at the front already), without affecting the relative order of the other items on the list. § Frequency Count (FC): Maintain a frequency count for each item, initially zero. (This requires extra space.) Increase the count of an item each time it is accessed/inserted; reduce its count to zero when deleted. Perform exchanges as necessary to maintain the list in non-increasing order of frequency counts. 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
C A E D A E D C Insert C 4 A E D Delete C 2 A C E D Search A 3 C E A D Search B 4 C E A D Insert C 3 E A C D A C D E Insert E 4 Move-to-Front Example A C D List Operation Cost 8
Background image of page 8
Move-to-Front Applications § Cash based Memory Management: - Small fast Cash versus large slower main memory. - Cash I/O page-in-page-out rules. - Least Recently Used (LRU) paging rule  Move-to-Front. [Sleator, Tarjan,
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
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 / 28

MF - CSE 4101/5101 Prof. Andy Mirzaian Move to Front Self...

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

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