CS 591, Lecture 15

Jared Saia University of New Mexico

Class Outline

• Presentations!!!

• Homework 2

• Finish up MARK Analysis

Class Presentations

• Each student will give a 30 minute presentation

• By October 29th (next Tuesday), you must speak to me (in office hours or by appointment) about your proposed presentation.

• By November 5th, you must turn in a 1 page detailed summary of what you will present. Give a description of the abstract problem, the algorithm(s), and all major theorems.

• Class Presentations will be given on November 19, 21 and 26th - choose a date now.

Class Presentations (II)

• The presentation should be on an algorithmic approach to a “real-world” problem or on a mathematical tool that is useful for real-world algorithms

• There should be some “mathematical meat” to your presentation. In particular, there should be some use of mathematical tools like the ones we learned in class (e.g. graph theory, probability theory, online analysis, etc.)

• It’s ok to present in groups of up to 3 people

• Find something that interests you!!!

Ideas for Presentations

• Graph Theory

• Probability Theory

• Spectral Analysis and Search Engines • Online Algorithms

• Smoothed Analysis

• Computational Biology

Graph Theory

• Data Migration with Space Constraints (see paper “On Algorithms for Efficient Data Migration” on course web page)

• Experimental Results on Data Migration (see paper “An Experimental Study of Data Migration Algorithms” on course page)

• Tutte’s Theorem for matchings in general graphs (see any graph theory book)

• Phylogeny Problems (see Bernard Moret)

Probability Theory

• Pattern Matching and Fingerprinting (see paper “Some applications of Rabin’s fingerprinting method” on course web page)

• How to Reduce the resource bounds for attack-resistant p2p networks (see paper “Censorship Resistant Peer-To-Peer Content Addressable Networks” on course web page)

Spectral Analysis

• The Google Algorithm (see ”The Anatomy of a Large-Scale Hypertextual Web Search Engine” on course web page)

• Theoretical Analysis of why spectral methods work for search (see paper “Spectral Analysis of Data” on course web page)

Online Algorithms

• Online Learning (see paper “Online Algorithms in Machine Learning” on course web page)

• Online Auctions (see me for appropriate references)

• Show that the lower bound for randomized paging against an oblivious adversary is O(log n)

Homework 2

• Problem 4, n∗2^{−k log n} = n^{k−1}. Make sure you simplify all answers as much as possible. Always want a single exponential when possible.

• Problem 5, After compute probability that a fixed segment has too many/too few points, need to use union bounds to compute probability that no segment has too many/too few points in it.

• Problem 6, don’t replace (1 − 1/n)^{n} with (1 − 1/e) until the very end of the computation. Make sure you state that this is an approximation as n → ∞

Homework 2, Problem 7

Part 1)

• Let p be the probability the coin is heads.

• Let a round be two flips of the coin. Say a round succeeds if there is one heads and one tails. Let r be the probability that a round succeeds

• Let t be the expected number of flips until a round succeeds. t = r ∗ 2 + (1 − r) ∗ (2 + t). Simplifying, we get t = f/r

HW 2, Problem 7

Part 2)

• We need a more efficient algorithm!

• Hint: Consider the first 4 biased flips

• If the first pair of flips are HT or TH, or the second pair or TH or HT, we can get a bit using the simple method

• Can improve things by pairing up HHTT and TTHH. Idea is to merge the same flips to get a multi-level strategy

Algorithm MARK

We will consider the randomized algorithm MARK defined as follows:

• Initially all pages are marked

• If there is a request for a page p which is in the cache but unmarked, then p is marked

• Otherwise if p is not in the cache, p is brought marked into the cache

• If all the pages in the cache are marked when p is brought in, they are all unmarked first

• The page that is evicted is chosen uniformly at random from all unmarked pages currently in the cache.

MARK Analysis

• Defn: H_{k} = 1 + 1/2 + 1/3 + ⋯ + 1/k

• Fact: ln k < H_{k} < 1 + ln k

• Theorem: The competitive ratio of Mark is 2 ∗ H_{k} • Fix a request sequence σ and partition it into phases of k

unique requests as before

• For each phase i, call the pages in the cache just before the start of the phase the old pages and call all other pages requested in the i-th phase new pages

• Note that each request in the i-th phase is to either an old or a new phase

• Note also that repeated requests to a new or old page don’t contribute to our cost since each page requested is kept in the cache until the end of the phase • Let m_{i} be the number of new pages requested in the i-th

phase

• The worst order for the MARK algorithm is if all requests to new pages precede requests to old pages

• In this order, the requests to new pages incur m_{i} faults

• What about the remaining k − m_{i} requests to old pages?

• What do we want?: We want to compute the expected number of misses on the k − m_{i} old pages

• We can get this using linearity of expectation if we can find the right probabilities.

• Q: What is the probability that the j-th old page requested will not be in the cache? (i.e. it will generate a fault)

• Q: What is the probability that the j-th old page requested is not in the cache?

• Let x_{j} be the j-th old page

• Let O be the set of old pages.

• Let O_{j} = O − {x_{1}, …, x_{j−1}} (i.e. the set of unmarked old pages when x_{j} is requested)

• Note that m_{i} of the pages in O_{j} have been evicted from the cache when x_{j} is requested. These m_{i} evicted pages are chosen uniformly at random from the set O_{j}

• Thus the probability that some fixed page (say x_{j}) in the set O_{j} has been evicted is m_{i}/|O_{j}| = m_{i}/k − (j − 1)

• Thus the probability that the j-th old page requested is not in the cache is m_{i}/k − j + 1

Mark Analysis

Hence the number of faults incurred by MARK is:

m_{i} + k−m_{i} ; ∑ ; j=1 \frac{m_{i}}{k − j + 1} = m_{i}(H_{k} − H_{m_{i}} + 1)  (1)
≤ m_{i}H_{k}  (2)

Bound for OPT

It’s not hard to bound OPT for this sequence:

• Let q_{i} be the number of faults to OPT in the i-th phase and let l be the total number of phases

• For i > 2, q_{i−1} + q_{i} ≥ k + m_{i}, since k + m_{i} distinct pages requested during these two phases.

l ; ∑ ; i=1(q_{i−1} + q_{i}) ≥ l ; ∑ ; i=2 m_{i}  (3)
2 ∗ l ; ∑ ; i=1 q_{i} − q_{1} ≥ l ; ∑ ; i=2 m_{i}  (4)
2 ∗ OP T ≥ q_{1} + l ; ∑ ; i=2 m_{i}  (5)
2 ∗ OP T ≥ l ; ∑ ; i=1 m_{i}  (6)

Take Away

• So MARK has no more than H_{k} ∗ ∑_{i} m_{i} faults

• OPT has at least 1/2(∑_{i} m_{i}) faults

• Hence the competitive ration is 2 ∗ H_{k}

• Note: There are variants of MARK that have been shown to be H_{k} competitive