find (x): given element x, return the canonical element of the set containing x;

Similar documents
Problem Set 9 Solutions

CHAPTER 17 Amortized Analysis

Affine transformations and convexity

Expected Value and Variance

Maximizing the number of nonnegative subsets

THE ARIMOTO-BLAHUT ALGORITHM FOR COMPUTATION OF CHANNEL CAPACITY. William A. Pearlman. References: S. Arimoto - IEEE Trans. Inform. Thy., Jan.

Linear, affine, and convex sets and hulls In the sequel, unless otherwise specified, X will denote a real vector space.

Lectures - Week 4 Matrix norms, Conditioning, Vector Spaces, Linear Independence, Spanning sets and Basis, Null space and Range of a Matrix

E Tail Inequalities. E.1 Markov s Inequality. Non-Lecture E: Tail Inequalities

REAL ANALYSIS I HOMEWORK 1

More metrics on cartesian products

Economics 101. Lecture 4 - Equilibrium and Efficiency

Week 2. This week, we covered operations on sets and cardinality.

20. Mon, Oct. 13 What we have done so far corresponds roughly to Chapters 2 & 3 of Lee. Now we turn to Chapter 4. The first idea is connectedness.

Edge Isoperimetric Inequalities

n α j x j = 0 j=1 has a nontrivial solution. Here A is the n k matrix whose jth column is the vector for all t j=0

The Order Relation and Trace Inequalities for. Hermitian Operators

The Minimum Universal Cost Flow in an Infeasible Flow Network

Polynomials. 1 More properties of polynomials

11 Tail Inequalities Markov s Inequality. Lecture 11: Tail Inequalities [Fa 13]

APPENDIX A Some Linear Algebra

Assortment Optimization under MNL

Math 261 Exercise sheet 2

Foundations of Arithmetic

First day August 1, Problems and Solutions

Singular Value Decomposition: Theory and Applications

a b a In case b 0, a being divisible by b is the same as to say that

HMMT February 2016 February 20, 2016

Thermodynamics Second Law Entropy

SELECTED SOLUTIONS, SECTION (Weak duality) Prove that the primal and dual values p and d defined by equations (4.3.2) and (4.3.3) satisfy p d.

Exercise Solutions to Real Analysis

Physics 5153 Classical Mechanics. Principle of Virtual Work-1

Problem Solving in Math (Math 43900) Fall 2013

n ). This is tight for all admissible values of t, k and n. k t + + n t

THE CHINESE REMAINDER THEOREM. We should thank the Chinese for their wonderful remainder theorem. Glenn Stevens

College of Computer & Information Science Fall 2009 Northeastern University 20 October 2009

Solutions to exam in SF1811 Optimization, Jan 14, 2015

Math1110 (Spring 2009) Prelim 3 - Solutions

12. The Hamilton-Jacobi Equation Michael Fowler

Lecture 3. Ax x i a i. i i

Spectral Graph Theory and its Applications September 16, Lecture 5

princeton univ. F 17 cos 521: Advanced Algorithm Design Lecture 7: LP Duality Lecturer: Matt Weinberg

Notes on Frequency Estimation in Data Streams

MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.265/15.070J Fall 2013 Lecture 12 10/21/2013. Martingale Concentration Inequalities and Applications

Section 8.3 Polar Form of Complex Numbers

Lecture 4: November 17, Part 1 Single Buffer Management

Temperature. Chapter Heat Engine

Lecture 3: Probability Distributions

Structure and Drive Paul A. Jensen Copyright July 20, 2003

Introductory Cardinality Theory Alan Kaylor Cline

Week3, Chapter 4. Position and Displacement. Motion in Two Dimensions. Instantaneous Velocity. Average Velocity

LECTURE V. 1. More on the Chinese Remainder Theorem We begin by recalling this theorem, proven in the preceeding lecture.

1 The Mistake Bound Model

3.1 Expectation of Functions of Several Random Variables. )' be a k-dimensional discrete or continuous random vector, with joint PMF p (, E X E X1 E X

Finding Dense Subgraphs in G(n, 1/2)

Poisson brackets and canonical transformations

The Multiple Classical Linear Regression Model (CLRM): Specification and Assumptions. 1. Introduction

NP-Completeness : Proofs

The internal structure of natural numbers and one method for the definition of large prime numbers

Complete subgraphs in multipartite graphs

Eigenvalues of Random Graphs

arxiv: v1 [math.co] 1 Mar 2014

Generalized Linear Methods

Lecture 4. Instructor: Haipeng Luo

Conservation of Angular Momentum = "Spin"

Online Classification: Perceptron and Winnow

Supplement: Proofs and Technical Details for The Solution Path of the Generalized Lasso

BOUNDEDNESS OF THE RIESZ TRANSFORM WITH MATRIX A 2 WEIGHTS

Canonical transformations

Stanford University CS359G: Graph Partitioning and Expanders Handout 4 Luca Trevisan January 13, 2011

9 Characteristic classes

How Strong Are Weak Patents? Joseph Farrell and Carl Shapiro. Supplementary Material Licensing Probabilistic Patents to Cournot Oligopolists *

Module 2. Random Processes. Version 2 ECE IIT, Kharagpur

2.3 Nilpotent endomorphisms

U.C. Berkeley CS294: Spectral Methods and Expanders Handout 8 Luca Trevisan February 17, 2016

Problem Do any of the following determine homomorphisms from GL n (C) to GL n (C)?

CALCULUS CLASSROOM CAPSULES

12 MATH 101A: ALGEBRA I, PART C: MULTILINEAR ALGEBRA. 4. Tensor product

Inner Product. Euclidean Space. Orthonormal Basis. Orthogonal

PHY688, Statistical Mechanics

Lecture Space-Bounded Derandomization

SUCCESSIVE MINIMA AND LATTICE POINTS (AFTER HENK, GILLET AND SOULÉ) M(B) := # ( B Z N)

Welfare Properties of General Equilibrium. What can be said about optimality properties of resource allocation implied by general equilibrium?

Chapter 9: Statistical Inference and the Relationship between Two Variables

Differentiating Gaussian Processes

Lecture 16. Chapter 11. Energy Dissipation Linear Momentum. Physics I. Department of Physics and Applied Physics

= z 20 z n. (k 20) + 4 z k = 4

Bernoulli Numbers and Polynomials

A 2D Bounded Linear Program (H,c) 2D Linear Programming

Basic Statistical Analysis and Yield Calculations

The Expectation-Maximization Algorithm

First Law: A body at rest remains at rest, a body in motion continues to move at constant velocity, unless acted upon by an external force.

MODELING TRAFFIC LIGHTS IN INTERSECTION USING PETRI NETS

COMPLEX NUMBERS AND QUADRATIC EQUATIONS

Homework Notes Week 7

Chemical Equilibrium. Chapter 6 Spontaneity of Reactive Mixtures (gases) Taking into account there are many types of work that a sysem can perform

Introduction to Algorithms

General theory of fuzzy connectedness segmentations: reconciliation of two tracks of FC theory

Dynamic Programming. Preview. Dynamic Programming. Dynamic Programming. Dynamic Programming (Example: Fibonacci Sequence)

k t+1 + c t A t k t, t=0

Transcription:

COS 43 Sprng, 009 Dsjont Set Unon Problem: Mantan a collecton of dsjont sets. Two operatons: fnd the set contanng a gven element; unte two sets nto one (destructvely). Approach: Canoncal element method: for each set, the algorthm mantans a canoncal element (arbtrary but unque), holdng any desred nformaton about the set. Two low-level operatons: fnd (x): gven element x, return the canoncal element of the set contanng x; ln(x, y): gven canoncal elements x and y, destructvely unte the sets contanng them, and mae x or y the canoncal element of the new set. (Do nothng f x = y.) Then unte can be mplemented as follows: unte (x, y) : unte the sets contanng (arbtrary) elements x and y (f they dffer) unte (x, y) = ln (fnd (x), fnd (y)) Tree-based mplementaton: the elements of each set form a tree, wth each node pontng to ts parent, va a p ponter. Each tree root ponts to tself. Assume n sngleton sets ntally (p(x) = x for every x ntally); m total fnds, nterspersed wth lns; m n.

To perform fnd, follow parent ponters to tree root. To perform compresson after a fnd, mae every node on the fnd path pont drectly to the root. Lnng by ran (ran s maxmum length, n edges, of an uncompressed path from a descendant) r (x) = 0 for every x ntally. To ln x and y, mae the smaller-raned root pont to the larger; n case of a te, ncrease the ran of the new root by one. Queston: What s the total tme for m fnds nterspersed wth lns? Answer: Om ( α( n)), where A ( ) 0 x = x + for x A ( ) + x = A x+ ( x) for x 0 + ( A( x) = x, A ( x) = A( A( x))) α ( n) = the smallest such that A () n From these defntons, A( x) = x+, A( x) > x A3 ( x ) >. } x + and α ( n) grows very slowly. Exercse: Prove that A ( x) s an ncreasng functon of both and x. To prove the Om ( α( n)) bound we use an amortzed analyss.

Observe that the ran of a node x starts at 0, can ncrease but not decrease whle x s a tree root, and remans constant once x s a nonroot. Observe also that r(p(x)) > r(x). Once x has a parent, r(x) s constant, but r(p(x)) can ncrease (but not decrease), ether because p(x) changes due to a compresson or r(p(x)) changes due to a ln. The maxmum node ran s at most n. (Why?) (Actually, t s at most lgn, but we won t use ths.) We wll defne a potental functon that assgns a non-negatve nteger potental of at most α( nrx ) ( ) to each node x; the total potental s the sum of all the node potentals. Any tree root x has potental α ( nrx ) ( ). (Thus the total ntal potental s 0.) Let x be a nonroot wth r(x). Defne the level of x, denoted by (x), to be the largest for whch r(p(x)) A (()). r x We have A (()) r x = r(x) + r(p(x)) and 0 Aα( n) (()) r x Aα( n) () n > n r( p()). x Thus (x) s well-defned and 0 (x) < α (n). Furthermore, snce r(p(x)) can never decrease, (x) can never decrease, only ncrease. Defne the ndex of x, denoted by (x), to be the largest for whch r(p(x)) A ( x) (r(x)). We have A ( x) (r(x)) = A ( x) (r(x)) r(p(x)) by the defnton of (x), and r( x) + A( x) (()) r x = A ( x) + (r(x)) > r(p(x)), by the defntons of A and (x). Thus (x) s welldefned and (x) r(x). Also, snce r(p(x)) can never decrease, (x) cannot decrease unless (x) ncreases: whle (x) remans constant, (x) can only ncrease or stay the same. Now we are ready to defne the potental of a node x. φ ( x) = α ( nrx ) ( ) f x s a root or r(x) = 0 φ ( x) = ( α( n) ( x)) r( x) ( x) f x s a nonroot and r(x) > 0 We defne the total potental Φ to be the sum over all nodes x of φ ( x). 3

Let us show that 0 φ( x) α( nrx ) ( ) for every node x. Ths s obvous f x s a root or r(x) = 0. Suppose x s a nonroot and r(x) > 0. Snce x ( ) α( n) and x ( ) rx ( ), φ( x) r( x) ( x) 0. Snce x ( ) 0 and x ( ), φ( x) α( n) r( x). What remans s to show that the amortzed cost of a ln or fnd s O( α ( n)). Frst consder a ln, say ln (x, y). Wthout loss of generalty suppose the ln maes y the new root. The actual cost of the ln s (order of) one. The potental of any node other than y can only decrease. (Exercse: show ths.). The potental of y stays the same or ncreases by α( n), snce r(y) stays the same or ncreases by one. Thus the ncrease of Φ due to the ln s at most α ( n), and the amortzed cost of the ln s at most α ( n) +. Consder a fnd wth compresson. The actual cost of the fnd s (order of) the number of nodes on the fnd path. No node can have ts potental ncrease as a result of the fnd. (Exercse: prove ths.) We shall show that f l s the number of nodes on the fnd path, at least max { 0, l ( α( n) + ) } of these nodes have ther potental decrease (by at least one) as a result of the compresson. Ths mples that the amortzed cost of the fnd s at most α ( n) +. Specfcally, let x be a node on the fnd path such that r(x) > 0 and x s followed on the fnd path by another nonroot node y such that (y) = (x). All but at most α ( n) + nodes on the fnd path satsfy ths constrant; those that do not are the frst node on the path (f t has ran zero), the last node on the path (the root), and the last node on the path of level, for each possble n the range 0 < α( n). Let = (x) = (y). Before the compresson, r p x A r x r p y A r y and ( x) ( ( )) ( ( )), ( ( )) ( ( )), r( y) r( p( x)). These nequaltes mply r( p( y)) A ( r( y)) A ( r( p( x))) A A r x ( x) ( ( ( ))) ( x) + = A (()), rx whch means that the compresson causes (x) to ncrease or (x) to ncrease, n ether case decreasng φ( x) by at least. (Exercse:prove ths.) 4

Suppose now that nstead of usng path compresson and lnng by ran, we use path compresson and naïve lnng, n whch we ln x and y by mang x the parent of y. The amortzed analyss that gves α( n) per operaton breas down for two reasons. The frst s that rans (hence levels and ndexes) are undefned. We can fx ths by defnng rans as follows: an ntal sngleton node has ran 0; when a ln of x and y s performed, mang x the parent of y, we replace the ran of x by max{ rx ( ), ry+ ( ) }. Then many of the needed propertes of rans hold. Specfcally, the ran of a node starts at 0, can ncrease but not decrease whle x s a root, and remans constant once x s a non-root. Also, r( p( x)) > r( x), and once x has a parent rxremans ( ) fxed but r( p( x)) can only ncrease. Even wth ths defnton of ran, the analyss breas down, because the ran of a root can ncrease by up to n durng a ln, and the amortzed tme for a ln s no longer O( α ( n)). We can obtan an O(log n) amortzed tme bound per operaton n ths case by changng the potental functon, however. We defne the log-level of a non-root node x to be gx ( ) = lg rpx ( ( )) rx ( ). Then 0 gx ( ) lg n. We defne the potental of a node x to be 0 f t s a root and lg n g( x) f t s a non-root. Then the ntal potental s zero, and the potental s always non-negatve, so the total tme of an arbtrary sequence of operatons s at most the sum of ther amortzed tmes. Consder an operaton ln( x, y ). The actual tme s O(). The potental of every node except x ether stays the same or decreases. The potental of x can ncrease by at most lg n (from 0 to lg n ). Thus the amortzed tme of a ln s O(lg n ). Consder a fnd wth compresson. Let l be the number of nodes on the fnd path. No node can have ts potental ncrease as a result of the fnd. We shall show that at least max{0, l lg n } nodes on the fnd path have ther potental decrease by at least one as a result of the compresson. Ths mples that the amortzed tme of the fnd s at most lg n +. Let x be a node on the fnd path such that x s followed on the fnd path by another non-root node y such that g( y) = g( x). All but at most lg n + nodes on the fnd path (the last for each possble log-level and the root) satsfy ths property. Let g = g( x) = g( y). Before the compresson, r( p( x)) r( x) g g and r( p( y)) r( y). After the compresson, the new parent of x has ran at least that of the old parent of y, g g g+ whch means that r( p ( x)) r( x) + =, where p denotes the new parent, and the compresson causes the log-level of x to ncrease by at least one, and hence ts potental to decrease by at least one. 5