1 Communication Complexity מגישים: 317735678 מיכאל זמור: 01762926/2 אבי מינץ: ערן מנצור: ת.ז. 02801532/9.

Slides:



Advertisements
Similar presentations
Lower Bounds for Local Search by Quantum Arguments Scott Aaronson (UC Berkeley) August 14, 2003.
Advertisements

Comp 122, Spring 2004 Order Statistics. order - 2 Lin / Devi Comp 122 Order Statistic i th order statistic: i th smallest element of a set of n elements.
Models of Computation Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms Week 1, Lecture 2.
Circuit and Communication Complexity. Karchmer – Wigderson Games Given The communication game G f : Alice getss.t. f(x)=1 Bob getss.t. f(y)=0 Goal: Find.
SEARCHING AND SORTING HINT AT ASYMPTOTIC COMPLEXITY Lecture 9 CS2110 – Spring 2015 We may not cover all this material.
Lecture 3: Parallel Algorithm Design
1 Parallel Parentheses Matching Plus Some Applications.
Primality Testing Patrick Lee 12 July 2003 (updated on 13 July 2003)
Sorted list matching & Experimental run-Time COP 3502.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 4 Instructor: Paul Beame TA: Gidon Shavit.
1 Today’s Material Medians & Order Statistics – Ch. 9.
Lectures on Recursive Algorithms1 COMP 523: Advanced Algorithmic Techniques Lecturer: Dariusz Kowalski.
Convex Hulls in Two Dimensions Definitions Basic algorithms Gift Wrapping (algorithm of Jarvis ) Graham scan Divide and conquer Convex Hull for line intersections.
Divide and Conquer. Recall Complexity Analysis – Comparison of algorithm – Big O Simplification From source code – Recursive.
T(n) = 4 T(n/3) +  (n). T(n) = 2 T(n/2) +  (n)
Nattee Niparnan. Recall  Complexity Analysis  Comparison of Two Algos  Big O  Simplification  From source code  Recursive.
Lectures on Network Flows
CSL758 Instructors: Naveen Garg Kavitha Telikepalli Scribe: Manish Singh Vaibhav Rastogi February 7 & 11, 2008.
Computability and Complexity 20-1 Computability and Complexity Andrei Bulatov Random Sources.
Tirgul 10 Rehearsal about Universal Hashing Solving two problems from theoretical exercises: –T2 q. 1 –T3 q. 2.
1 Algorithms for Large Data Sets Ziv Bar-Yossef Lecture 8 May 4, 2005
Randomized Computation Roni Parshani Orly Margalit Eran Mantzur Avi Mintz
Properties of Logarithms Tools for solving logarithmic and exponential equations.
CPSC 411, Fall 2008: Set 4 1 CPSC 411 Design and Analysis of Algorithms Set 4: Greedy Algorithms Prof. Jennifer Welch Fall 2008.
1 Cryptosystems Based on Discrete Logarithms. 2 Outline [1] Discrete Logarithm Problem [2] Algorithms for Discrete Logarithm –A trivial algorithm –Shanks’
Deciding Primality is in P M. Agrawal, N. Kayal, N. Saxena Slides by Adi Akavia.
Tirgul 8 Universal Hashing Remarks on Programming Exercise 1 Solution to question 2 in theoretical homework 2.
Derandomizing LOGSPACE Based on a paper by Russell Impagliazo, Noam Nissan and Avi Wigderson Presented by Amir Rosenfeld.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (3) Recurrence Relation 11/11 ~ 11/14/2008 Yang Song.
Theory I Algorithm Design and Analysis (9 – Randomized algorithms) Prof. Dr. Th. Ottmann.
DAST 2005 Week 4 – Some Helpful Material Randomized Quick Sort & Lower bound & General remarks…
11 -1 Chapter 11 Randomized Algorithms Randomized algorithms In a randomized algorithm (probabilistic algorithm), we make some random choices.
1 Algorithms for Large Data Sets Ziv Bar-Yossef Lecture 13 June 22, 2005
Induction and recursion
Quadratic Residuosity and Two Distinct Prime Factor ZK Protocols By Stephen Hall.
Genetic Algorithm.
CSCI 2670 Introduction to Theory of Computing November 10, 2005.
Recursion Chapter 7 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
Recursion, Complexity, and Searching and Sorting By Andrew Zeng.
Computer Science and Engineering Parallel and Distributed Processing CSE 8380 February 8, 2005 Session 8.
Chapter 14 Randomized algorithms Introduction Las Vegas and Monte Carlo algorithms Randomized Quicksort Randomized selection Testing String Equality Pattern.
The Complexity of Primality Testing. What is Primality Testing? Testing whether an integer is prime or not. – An integer p is prime if the only integers.
Recursion, Complexity, and Sorting By Andrew Zeng.
Nattee Niparnan. Recall  Complexity Analysis  Comparison of Two Algos  Big O  Simplification  From source code  Recursive.
C++ Programming: From Problem Analysis to Program Design, Second Edition Chapter 19: Searching and Sorting.
Cryptography Lecture 7: RSA Primality Testing Piotr Faliszewski.
11 -1 Chapter 11 Randomized Algorithms Randomized Algorithms In a randomized algorithm (probabilistic algorithm), we make some random choices.
Design of Algorithms using Brute Force Approach. Primality Testing (given number is n binary digits)
Télécom 2A – Algo Complexity (1) Time Complexity and the divide and conquer strategy Or : how to measure algorithm run-time And : design efficient algorithms.
CSC 211 Data Structures Lecture 13
Algorithms 1.Notion of an algorithm 2.Properties of an algorithm 3.The GCD algorithm 4.Correctness of the GCD algorithm 5.Termination of the GCD algorithm.
. Parameter Estimation and Relative Entropy Lecture #8 Background Readings: Chapters 3.3, 11.2 in the text book, Biological Sequence Analysis, Durbin et.
UNIT 5.  The related activities of sorting, searching and merging are central to many computer applications.  Sorting and merging provide us with a.
Umans Complexity Theory Lectures Lecture 7b: Randomization in Communication Complexity.
Communication Complexity Guy Feigenblat Based on lecture by Dr. Ely Porat Some slides where adapted from various sources Complexity course Computer science.
1 Ch. 2: Getting Started. 2 About this lecture Study a few simple algorithms for sorting – Insertion Sort – Selection Sort (Exercise) – Merge Sort Show.
Young CS 331 D&A of Algo. Topic: Divide and Conquer1 Divide-and-Conquer General idea: Divide a problem into subprograms of the same kind; solve subprograms.
1 Recursive algorithms Recursive solution: solve a smaller version of the problem and combine the smaller solutions. Example: to find the largest element.
Sorting & Lower Bounds Jeff Edmonds York University COSC 3101 Lecture 5.
INTRO2CS Tirgul 8 1. Searching and Sorting  Tips for debugging  Binary search  Sorting algorithms:  Bogo sort  Bubble sort  Quick sort and maybe.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Section Recursion  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Lecture 3: Parallel Algorithm Design
Quick-Sort 9/12/2018 3:26 PM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Topic: Divide and Conquer
Divide-and-Conquer 7 2  9 4   2   4   7
CS21 Decidability and Tractability
Quick-Sort 4/25/2019 8:10 AM Quick-Sort     2
Time Complexity and the divide and conquer strategy
Presentation transcript:

1 Communication Complexity מגישים: מיכאל זמור: /2 אבי מינץ: ערן מנצור: ת.ז /9

2 Communication Complexity The Model 2 Computers : A,B All calculations for A are free All calculations for B are free Algorithm costs are measured by cost of communications. Cost is measured per bits

3 Communication Complexity The Model Communication Complexity 14, 29,53,28,284,34839, 67,98,22,35,253 (48) (98) A B

4 Example Input A has array of n numbers B has array of n numbers Output median of all 2n numbers Heuristic numbers are O(log n) bits long

5 Naïve Algorithm 1.A sends all of his numbers to B 2.B calculates median of all 2n numbers Cost –Each number is O(log n) bits –N numbers are sent –Total cost is O(n*log n) bits

6 Communication Complexity Naive algorithm Communication Complexity 14, 29,53,28,284,34839, 67,98,22,35,253 (284) (348) (53) (29) (14) A B Total cost is O(n*log n) bits

7 Communication Complexity Naive algorithm Communication Complexity 14, 29,53,28,284,34839, 67,98,22,35,25314, 29,53,28,284,348 B calculate the median A B

8 Better algorithm 1.A sorts his array and sends his median ( ) to B 2.B sorts his array and sends his median ( ) to A. 3.Exercise : define : r = real median b = MAX{ } s = MIN { } prove :

9 Communication Complexity Better algorithm Communication Complexity 14, 28,29, 53,284,348,50022, 35,39, 67,98,253,300 A B B sort his array and find his median A sort his array and find his median

10 Communication Complexity Better algorithm Communication Complexity 14, 28,29, 53,284,348,50022, 35,39, 67,98,253,300 A B B send his median to A A send his median to B

11 4. If = then return ( = ) 5. If > then A throws top (n/2) elements B throws low (n/2) elements 6. And vice versa We reduces the size of the problem by half 7. Back to step 1, until size of arrays = 1

12 Communication Complexity Better algorithm Communication Complexity, 53,284,348,500 A B 67>53 Then B throws the big half of his array 53<67 Then A throws the small half of his array 14, 28,29 22, 35,39, 67,98,253,300

13 Communication Complexity Better algorithm Communication Complexity, 53,284,348,500 A B 14, 28,29 22, 35,39, 67,98,253,300 Since equal amount of members were thrown from two sides of the median So, new median not changed.

14 Communication Complexity Better algorithm Communication Complexity, 53,284,348,500 A B 14, 28,29 22, 35,39, 67,98,253,300 We will repeat this algorithm until the size of the array will be 1, while every loop the array is cut in half, and log n bits transferred Total cost is O (Log^2(n)) bits

15 Calculation of cost Each number is O(log n) bits Each step 2 numbers are sent log(n) steps Total cost is O (Log^2(n)) bits

16 Communication Complexity A B A calculates his median - B calculates his median another improvement

17 Two assumptions 1)The requested median is between the A’s median and B’s median A’s median B’s median The requested median between A’s and B’s median * (we have an even amount of numbers, so we choose the the 6 th place of the 10 numbers)

18 Two assumptions 2) In binary representation we divide the medians to common segment and different segment. Note: Sometimes there is no common segment, but if there is common for A’s and B’s medians then its common to the request median. Decimalbinary representation Common segment Different segment

19 Communication Complexity A B After those assumptions we continue…. Every side send each bit of his median (start from MSB bit) 27 = b 20 = b b1 b 1 b1 b

20 Communication Complexity A B Every side compares the bit he gets with the bit of his median. If equal, those bits are in the “common segment” (see slide 17) and this common to the request median then every side continue send the next bit of his median. 20 = b 1 b1 b 27 = b 1 b1 b

21 Communication Complexity A B If not equal then A sees that his median is bigger, so he throws the bigger half of his array, B sees that his median is smaller then A’s median, so he throws the smaller half of his array 27 = b 0 b0 b 20 = b 1 b1 b

22 Communication Complexity A B , After throwing half of his array, every side calculates his new median. Every side send bits of the new median, starting from the bit that there was different in the previous iteration ( and not from the MSB bit). Every side continues the algorithm.

23 Communication Complexity A B The algorithm stops when one of two events occur. 1) the arrays of A and B contain one element (each). 2) all bits of the medians were sent.

24 Communication Complexity A B If arrays contain one element so this element is the median. If all bits were sent so the medians are equal and this is the request median.

25 Complexity of algorithm Every iteration one of this events occur Bit is send to the other sides. (log n bits can be sent from every side) The array become shorter by half. (the array can reduce by half, log n times) So, sum of bits can be sent limited by O(log n).

26 Communication complexity The previous subject talked about problem of finding median of array that was divided to two parts. Now we consider a new problem : Each side has a number and we want to know if the numbers are equal. Communication Complexity A B X Y ? X=Y

27 Communication complexity Naïve algorithm A send X to B. B compares X to Y and return yes/no X is logX bits long so cost is logX Communication Complexity A B X Y X

28 Communication complexity New random algorithm - GLOBAL CC Communication Complexity A B X Y ? X=Y In this algorithm we have a random number R, that can be changed and known for both sides.

29 Communication complexity GLOBAL CC Communication Complexity A B X Y Lets define inner product of A and B: A  [0…..n-1], B  [0…..n-1]

30 Communication complexity GLOBAL CC Communication Complexity A B X Y A: calculates (X*R)mod 2 B: calculates (Y*R)mod 2

31 Communication complexity GLOBAL CC Communication Complexity A B X Y b X =(X*R)mod 2 b Y =(Y*R)mod 2 If X=Y then always b X= b Y If x ≠ Y then Prob(b X= b Y )=1/2

32 Communication complexity GLOBAL CC Communication Complexity A B X Y b X =(X*R)mod 2b Y =(Y*R)mod 2 Every side sends his result (b) and compares the results. If the results are not equal so the numbers are not equal. bXbX bYbY

33 Communication complexity GLOBAL CC Communication Complexity A B X Y b X =(X*R new )mod 2 b Y =(Y*R new )mod 2 We choose a new R and repeat the algorithm. We do so C times.

34 Communication complexity GLOBAL CC Communication Complexity A B X Y If X=Y then all C times b X = b Y. If X≠Y the probability that all C times b X = b Y is 2 -c.

35 Communication complexity Complexity of global CC Communication Complexity A B X Y Each time every side transfers b X/Y by length of 1 bit. There are C times so every side transfers C bits. Complexity = O ( C )

36 Communication complexity Another random algorithm Communication Complexity A B X Y In this algorithm every side constructs a polynom from his number according to these steps: Every number consist of n bits. X  [a n-1, a n-2,…..,a 1,a 0 ]Y  [a n-1, a n-2,…..,a 1,a 0 ]

37 Communication complexity Communication Complexity A B X Y Polynom of side A will be: Poly A (T)= a n-1 *T n-1 + a n-2 *T n-2 +…..+ a 0 *T 0 X  [a n-1, a n-2,…..,a 1,a 0 ]Y  [b n-1, b n-2,…..,b 1,b 0 ] Step 1:

38 Communication complexity Communication Complexity A B X Y Like side A polynom B will be: Poly b (T)= b n-1 *T n-1 + b n-2 *T n-2 +…..+ b 0 *T 0 X  [a n-1, a n-2,…..,a 1,a 0 ]Y  [b n-1, b n-2,…..,b 1,b 0 ] Step 1:

39 Communication complexity Communication Complexity A B X Y X  [a n-1, a n-2,…..,a 1,a 0 ]Y  [b n-1, b n-2,…..,b 1,b 0 ] Step 2: A chooses random prime p : n 2 <p < n 3 A sends p to B

40 Communication complexity Communication Complexity A B X Y Step 3: B chooses 1≤R ≤ p-1 and calculates (poly b (R) mod p) Remind: Poly b (R)= b n-1 *R n-1 + b n-2 *R n-2 +…..+ b 0 *R 0 B sends (R, (poly b (R) mod p) ) to A.

41 Communication complexity Communication Complexity A B X Y Step 4: A calculates poly a (R) mod p A compares (poly a (R) mod p) with (poly b (R) mod p)

42 Communication complexity Communication Complexity A B X Y Analysis of algorithm If poly a (R)  poly b (R) Then X  Y

43 Communication complexity Communication Complexity A B X Y Analysis of algorithm But if poly a (R) = poly b (R) there is some probability that X  Y. We will calculate F: F=prob(X  Y and poly a (R) = poly b (R))

44 Communication complexity Communication Complexity A B X Y Analysis of algorithm poly a (R) = poly b )R) poly a (R) - poly b )R)=0 F=prob[X  Y and poly a (R) = poly b )R(]= prob[X  Y and poly a (R)-poly b )R(=0]. poly a (R)-poly b )R(=0 is a polynom of degree n it has n-1 roots.

45 Communication complexity Communication Complexity A B X Y Analysis of algorithm Because there are n-1 R’s s.t. poly a (R)-poly b )R(=0. And 1<=R<=p-1. So the probability to choose one of those R’s is: (n-1)/p.

46 Communication complexity Communication Complexity A B X Y Analysis of algorithm We saw that n 2 <p < n 3 So: n-1/p>(n-1)/ n 2  1/n F=prob(X  Y and poly a (R) = poly b (R))<1/n The probability of mistake is:1/n

47 Communication complexity Communication Complexity A B X Y Analysis of algorithm Communication complexity: The sides transferred p and R only: n2 <p < n3 |p|=O(log n) And R<p So the total complexity is : O(log n)

48 Communication complexity Communication Complexity A B X Y CC and Global CC What is the complexity relation between CC and GCC Note: CC is the last alogorithm we had seen.

49 Communication complexity Communication Complexity A B X Y solution A and B have a deterministic Turing machine which generates (deterministically) K random r’s. (while K= )

50 Communication complexity Communication Complexity A B X Y solution Define R to be the chain of K’s random r’s R

51 Communication complexity Communication Complexity A B X Y Now, instead of A sending r to B, A only has to send index in R. The index can be sent with O(log( ) bits =O(log n)

52 Communication complexity Communication Complexity A B X Y Claim: For each subset of R there is in the subset that is never wrong for each (x,y).

53 Communication complexity Communication Complexity A B X Y Proof:

54 Communication complexity Communication Complexity A B X Y Proof:

55 Communication complexity Communication Complexity A B X Y So:

56 Communication complexity Communication Complexity A B X Y Conclusion: