Lecture 23 (05/04/2026) - List Update Problem (3 Algorithms); Introduce Multiplicative Weight Updates
Scribes: Noman Saleemi and Ahmed Malik
Review of Online Algorithms
Section titled “Review of Online Algorithms”Online algorithms require making decisions on the fly without knowing future update sequences in advance. To evaluate an online algorithm, its performance is compared to an optimal offline algorithm (often referred to as “God’s algorithm”) that has full knowledge of the entire sequence of updates well in advance. This comparison is quantified using a competitive ratio. Examples from previous classes include the ski rental problem, which has a competitive ratio of two, and the pizza finding problem, which has a competitive ratio of nine.
The List Update Problem
Section titled “The List Update Problem”Problem Statement
Section titled “Problem Statement”In the list update problem, an algorithm must maintain a linked list of keys, denoted as . An online sequence of requests arrives: , where we assume . When a request arrives, the algorithm pays a cost equal to the current position of in the linked list because it must walk from the front to find it.
After the key is accessed, the algorithm is allowed to move to any previous position in the linked list for free in order to make it readily available for future requests. The overall objective is to minimize the total access cost over the entire sequence.
Approach 0: Do Nothing
Section titled “Approach 0: Do Nothing”The most trivial algorithm simply leaves the list unchanged, never moving the requested elements.
Analysis: Let the initial linked list be . A bad access sequence for this approach is repeatedly requesting the last element of the list times, i.e., . Each request costs , leading to a total cost of .
An optimal algorithm (OPT) would move the last element to the front of the list after its first access. OPT pays for the first access and for all remaining accesses, yielding a cost bounded by . Comparing the two costs reveals the competitive ratio:
Because the ratio depends on , this is a poor competitive ratio.
Approach 1: Order by Frequency
Section titled “Approach 1: Order by Frequency”Another approach is to maintain the list based on the current access frequency of the keys, moving more frequently requested keys to the front of the list. Whenever a key appears, its frequency is updated, and if its new frequency surpasses the preceding item, it is moved forward.
Analysis: A bad sequence for this algorithm involves accessing the first key times, the second key times, and so on, up to the -th key:
After half of sequence has gone by, keys occupy the first half of the linked list, while keys are in the second half. For the remaining half of the sequence, each request targets a key in the second half of the list, costing at least per access. Since there are requests in the second half of , the cost is at least:
Is there a better algorithm for this sequence? An algorithm that simply moves a new element to the front of the list would incur a cost of at most for the first access of a key, and for the remaining accesses. The total cost would be at most . Therefore, . The competitive ratio of the “Order by Frequency” algorithm is therefore at least:
Approach 2: Move to Front (MTF)
Section titled “Approach 2: Move to Front (MTF)”The “Move-to-Front” algorithm dictates that after walking to the requested element , it is immediately moved to the front of the list. Despite its simplicity, this heuristic is highly competitive.
Theorem: The Move-to-Front algorithm is 2-competitive. For all sequences , the cost is bounded by:
If the sequence length is longer than , the term becomes positive, leading to:
This mathematically guarantees a competitive ratio of strictly less than 2 for long enough sequences.
Proof Concept: Proving this theorem requires the potential function method, which acts like a piggy bank that stores value when the algorithm is faster than and borrows from the bank when it is slower. An obvious per-request approach (attempting to prove ) fails because MTF may occasionally be much slower than OPT on individual requests.
Multiplicative Weight Updates
Section titled “Multiplicative Weight Updates”Problem Statement and Experts’ Theorem
Section titled “Problem Statement and Experts’ Theorem”The Multiplicative Weight Updates (MWU) algorithm is highly relevant in machine learning and statistical modeling. Suppose we must make a binary decision every day, such as deciding whether to sell or buy a stock. We have experts to assist us with their advice. At the end of the day, we observe the true outcome and identify which experts’ suggestions were correct and which were mistakes. The objective is to devise a strategy that performs almost as well as the best expert in hindsight.
The Weighted Majority Algorithm
Section titled “The Weighted Majority Algorithm”The Weighted Majority algorithm dictates the following procedure:
- Initially, all experts are assigned a weight of 1, meaning for all .
- At every step , we possess a weight for each expert . Our decision at time is to “sell” if at least half the total weight of the experts say to sell (i.e., if weight of experts say sell). Otherwise, we buy. If the weights are exactly equal, we flip a coin.
- At step , the weights are updated based on the actual outcome at time :
Here, acts as a penalty parameter that reduces our confidence in experts who make mistakes.
We calculate the mistakes (experts who ended up being incorrect based on the chosen decision) by the following:
Performance Guarantee
Section titled “Performance Guarantee”Theorem: After steps, let be the total number of mistakes made by the Weighted Majority algorithm so far, and let be the number of mistakes made by expert so far. The total mistakes made by the algorithm satisfies the bound:
Because this guarantee holds for all , it holds in particular when is the single best expert. If we ignore the additive term (which becomes negligible for long sequences), the algorithm guarantees that our total errors are at most roughly twice the errors of the best expert.