Correctness of Constructing Optimal Alphabetic Trees Revisited Marek Karpinski, Lawrence L. Larmore, Wojciech Rytter Theoretical computer science 180 (1997)
18/12/ Outline Definitions General version of Garsia-Wachs (GW) algorithm Proof of GW Hu-Tacker (HT) algorithm Proof of HT by similarity to GW
18/12/ Definitions Binary tree: Every internal node has exactly two sons
18/12/ Definitions
18/12/ The Move Operator
18/12/ The Move Operator
18/12/ The Move Operator
18/12/ The Move Operator
18/12/ Definitions
18/12/ Theorem 1 (correctness of GW)
18/12/ Garsia-Wachs Algorithm
18/12/ Definitions
18/12/ Theorem 2
18/12/ Shift Operations
18/12/ Shift Operations
18/12/ LeftShift Example
18/12/ LeftShift Example
18/12/ LeftShift Example
18/12/ LeftShift Example
18/12/ LeftShift Example
18/12/ LeftShift Example
18/12/ LeftShift Example
18/12/ LeftShift Example
18/12/ LeftShift Example
18/12/ Theorem 2
18/12/ Proof of Point 2 in Theorem 2
18/12/ Proof of Point 2 in Theorem 2
18/12/ Proof of Point 3 Theorem 2
18/12/ Definition of Well Shaped Segments
18/12/ Definition of Well Shaped Segments Active Window
18/12/ Movability Lemma If the segment [i,…,j] is left well shaped, then the active pair (i,i+1) can be moved to the other side of the segment by locally rearranging sub-trees in the active window without changing the relative order of the other items and without changing the level function of the tree.
18/12/ Movability Lemma
18/12/ Movability Lemma
18/12/ Movability Lemma
18/12/ Movability Lemma
18/12/ Movability Lemma
18/12/ Theorem 3
18/12/ Point 1 in Theorem 2
18/12/ Hu-Tucker Algorithm Transparent items and opaque items Compatible pair – No opaque items in the middle Minimal compatible pair (mcp) – compatible pair (i,i+1) where Weight(i) + weight(i+1) is minimal Tie Breaking Rule
18/12/ Hu-Tucker Algorithm
18/12/ Hu-Tucker Algorithm
18/12/ Hu-Tucker Algorithm
18/12/ Hu-Tucker Algorithm
18/12/ GW` Algorithm gmp – Globaly Minimal Pair GW` - the same as GW but always choose gmp instead of some other lmp.
18/12/ Definitions Special sequence – sequence of weights, each one is either transparent or opaque Normal sequence – sequence of weights MoveTransparent operator – converts a special sequence into a normal sequence and moves all transparent items to their RightPos. (first it moves the rightmost item, then the one to its left, etc…)
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ MoveTransparent
18/12/ The Simulation Lemma Assuming there are no ties
18/12/ Proof of the Simulation Lemma Claim A Claim B
18/12/ Proof of Claim A By contradiction assume that w,u are not visible to each other. This means there is an opaque item q between them. Two cases:
18/12/ Proof of Claim A Contradiction – no place for q
18/12/ Proof of Claim A
18/12/ Proof of Claim A Contradiction – no place for q
18/12/ Proof of Claim B Claim B Proof
18/12/ Proof of Claim B The order of movements is from right to left, thus w is Processed first then the items between u and w, and then u. At this point u and w must be adjacent, thus q must be processed later, and thus it is to the left of u. q is not visible from u because (u,w) is mcp
18/12/ Proof of Claim B Let q` be the opaque item between q and u visible from u Contradiction
18/12/ Conclusion
18/12/ Claim C
18/12/ Proof of claim C
18/12/ Proof of Simulation Lemma The proof of the lemma is by induction
18/12/ Tie Braking Rule Theorem 4 The Tie Breaking Rule (TBR) is correct Proof
18/12/ Proof of TBR Case 1: All weights are strictly positive
18/12/ Proof of TBR Case 2: Some of the original weights are zero