Big-Oh notation and P vs NP

Similar documents
Computational Complexity

Growth of Functions (CLRS 2.3,3)

Analysis of Algorithms

Time complexity analysis

Analysis of Algorithms

EECS 477: Introduction to algorithms. Lecture 5

CS 4407 Algorithms Lecture 2: Growth Functions

MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 2

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency

CS 4407 Algorithms Lecture 2: Iterative and Divide and Conquer Algorithms

3.1 Asymptotic notation

P, NP, NP-Complete, and NPhard

with the size of the input in the limit, as the size of the misused.

Running Time Evaluation

CIS 121 Data Structures and Algorithms with Java Spring Big-Oh Notation Monday, January 22/Tuesday, January 23

Data Structures and Algorithms. Asymptotic notation

The Time Complexity of an Algorithm

CSC Design and Analysis of Algorithms. Lecture 1

Lecture 1: Asymptotics, Recurrences, Elementary Sorting

Algorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc.

Reading 10 : Asymptotic Analysis

Asymptotic Analysis. Slides by Carl Kingsford. Jan. 27, AD Chapter 2

Md Momin Al Aziz. Analysis of Algorithms. Asymptotic Notations 3 COMP Computer Science University of Manitoba

Big O 2/14/13. Administrative. Does it terminate? David Kauchak cs302 Spring 2013

CS 4407 Algorithms Lecture 3: Iterative and Divide and Conquer Algorithms

Data Structures and Algorithms

The Time Complexity of an Algorithm

CSC 373: Algorithm Design and Analysis Lecture 30

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 3. Θ Notation. Comparing Algorithms

5 + 9(10) + 3(100) + 0(1000) + 2(10000) =

Big O Notation. P. Danziger

Lecture 11: Non-Interactive Zero-Knowledge II. 1 Non-Interactive Zero-Knowledge in the Hidden-Bits Model for the Graph Hamiltonian problem

Ch01. Analysis of Algorithms

Entry Number:2007 mcs Lecture Date: 18/2/08. Scribe: Nimrita Koul. Professor: Prof. Kavitha.

Cryptography and Security Midterm Exam

Great Theoretical Ideas in Computer Science. Lecture 9: Introduction to Computational Complexity

Omega notation. Transitivity etc.

Lecture Examples of problems which have randomized algorithms

Module 1: Analyzing the Efficiency of Algorithms

Ch 01. Analysis of Algorithms

Theory of Computation

csci 210: Data Structures Program Analysis

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu

Lecture 2. More Algorithm Analysis, Math and MCSS By: Sarah Buchanan

Theory of Computation

Great Theoretical Ideas in Computer Science. Lecture 7: Introduction to Computational Complexity

Introduction to Algorithms and Asymptotic analysis

More Asymptotic Analysis Spring 2018 Discussion 8: March 6, 2018

Lecture 11 - Basic Number Theory.

csci 210: Data Structures Program Analysis

Growth of Functions. As an example for an estimate of computation time, let us consider the sequential search algorithm.

Design and Analysis of Algorithms

Applied Cryptography and Computer Security CSE 664 Spring 2018

Theoretical Cryptography, Lectures 18-20

CS473 - Algorithms I

Lecture 1 - Preliminaries

CPSC 467b: Cryptography and Computer Security

Asymptotic Analysis of Algorithms. Chapter 4

COMP 9024, Class notes, 11s2, Class 1

Introduction to Computer Science Lecture 5: Algorithms

Notes on Zero Knowledge

Cosc 412: Cryptography and complexity Lecture 7 (22/8/2018) Knapsacks and attacks

Asymptotic Analysis. Thomas A. Anastasio. January 7, 2004

CSC236 Week 4. Larry Zhang

Principles of Algorithm Analysis

Applied Cryptography and Computer Security CSE 664 Spring 2017

When we use asymptotic notation within an expression, the asymptotic notation is shorthand for an unspecified function satisfying the relation:

CSED233: Data Structures (2017F) Lecture4: Analysis of Algorithms

Algorithms and Their Complexity

Asymptotic Analysis 1

10 Concrete candidates for public key crypto

Please give details of your answer. A direct answer without explanation is not counted.

Math 3012 Applied Combinatorics Lecture 5

COMP 382: Reasoning about algorithms

Overview. Background / Context. CSC 580 Cryptography and Computer Security. March 21, 2017

Lecture 2: Asymptotic Notation CSCI Algorithms I

CSE 101. Algorithm Design and Analysis Miles Jones Office 4208 CSE Building Lecture 1: Introduction

This chapter covers asymptotic analysis of function growth and big-o notation.

Big O Notation. P. Danziger

Lecture 7: CPA Security, MACs, OWFs

Asymptotic Notation. such that t(n) cf(n) for all n n 0. for some positive real constant c and integer threshold n 0

CS Non-recursive and Recursive Algorithm Analysis

Assignment 5 Bounding Complexities KEY

Introduction to Cryptography

Lecture Notes 17. Randomness: The verifier can toss coins and is allowed to err with some (small) probability if it is unlucky in its coin tosses.

Answer the following questions: Q1: ( 15 points) : A) Choose the correct answer of the following questions: نموذج اإلجابة

Lecture 1: Asymptotic Complexity. 1 These slides include material originally prepared by Dr.Ron Cytron, Dr. Jeremy Buhler, and Dr. Steve Cole.

6.045: Automata, Computability, and Complexity (GITCS) Class 17 Nancy Lynch

Module 1: Analyzing the Efficiency of Algorithms

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

Lecture 6. 2 Adaptively-Secure Non-Interactive Zero-Knowledge

Math 2602 Finite and Linear Math Fall 14. Homework 8: Core solutions

Introduction to Quantum Computing

Big , and Definition Definition

1 Randomized Computation

Lecture 5. 1 Review (Pairwise Independence and Derandomization)

Concurrent Non-malleable Commitments from any One-way Function

Recursion. Computational complexity

A Note on Negligible Functions

Cpt S 223. School of EECS, WSU

Transcription:

Big-Oh notation and P vs NP Hao Chung This presentation is mainly adapted from the lecture note of Prof. Mark Zhandry July 17, 2017 Hao Chung (NTU) crypto July 17, 2017 1 / 21

Overview 1 Big-Oh notation 2 Probabilistic Polynomial-Time (PPT) 3 P vs NP Hao Chung (NTU) crypto July 17, 2017 2 / 21

Outline 1 Big-Oh notation 2 Probabilistic Polynomial-Time (PPT) 3 P vs NP Hao Chung (NTU) crypto July 17, 2017 3 / 21

How to Compare Algorithms Say we want to compute a function f (n) Algorithm 1 runs in 100, 000n seconds Algorithm 2 runs in n 2 seconds Which algorithm is better? Algorithm 2 runs faster if n < 100, 000 Algorithm 1 runs faster if n > 100, 000 The ratio of run times goes to infinity Hao Chung (NTU) crypto July 17, 2017 4 / 21

How to Compare Algorithms Say we want to compute a function g(n) Algorithm 1 runs in 20n seconds Algorithm 2 runs in 10n + 30 seconds Which algorithm is better? Algorithm 2 is faster than Algorithm 1 when n > 3 However, it is only twice as fast Hao Chung (NTU) crypto July 17, 2017 5 / 21

Big-Oh Definition Let f (n) and g(n) be functions from positive reals to positive reals. Then, O(f (n)) = {g(n) : c, n 0 such that g(n) c f (n) for all n > n 0 } In human language: g(n) O(f (n)) if 1 there exists a constant c and a threshold n 0 such that 2 g(n) c f (n) for all n larger than n 0 Remark: Sometimes we abuse the notation and write g(n) = O(f (n)); however, you should aware that O(f (n)) is a set. Hao Chung (NTU) crypto July 17, 2017 6 / 21

Big-Oh Examples Example Let f (n) = 10n + 30, g(n) = 20n. Prove f (n) O(g(n)) and prove g(n) O(f (n)). Proof: Let c = 1, n 0 = 3. = If n n 0, then f (n) = 10n + 30 20n = cg(n). Let c = 2, n 0 = 1. = If n n 0, then g(n) = 20n 2x(10n + 30) = cf (n). Hao Chung (NTU) crypto July 17, 2017 7 / 21

Big-Oh Examples Example Let f (n) = 100, 000n, g(n) = n 2. Prove f (n) O(g(n)). Hao Chung (NTU) crypto July 17, 2017 8 / 21

Big-Oh Examples Example Let f (n) = n 4 + 3n + 500. Prove f (n) O(n 4 ). Hao Chung (NTU) crypto July 17, 2017 9 / 21

Big-Oh Properties Big Oh allows us to ignore constant factors: For any constant c, c f (n) O(f (n)). For example, addition costs 1 iteration on CPU and division costs 32 iteration on CPU. But whether count division as an elementary operation doesn t affect the time complexity. Hao Chung (NTU) crypto July 17, 2017 10 / 21

Big-Oh Properties Big Oh allows us to ignore lower order terms: If f (n) O(g(n)), then g(n) + f (n) O(g(n)). e.g. O(n 4 + 3n 2 + 1) = O(n 4 ). If there are many parts in an algorithm, the most expensive part will dominate. Hao Chung (NTU) crypto July 17, 2017 11 / 21

Big-Omega Definition Let f (n) and g(n) be functions from positive reals to positive reals. Then, Ω(f (n)) = {g(n) : c, n 0 such that g(n) c f (n) for all n > n 0 } In human language: g(n) Ω(f (n)) if 1 there exists a constant c and a threshold n 0 such that 2 g(n) c f (n) for all n larger than n 0 Hao Chung (NTU) crypto July 17, 2017 12 / 21

Big-Theta Definition Let f (n) and g(n) be functions from positive reals to positive reals. Then, Θ(f (n)) = {g(n) : c 1 > 0, c 2, n 0 such that c 1 f (n) g(n) c 2 f (n) for all n > n 0 } In human language: g(n) Θ(f (n)) if 1 there exists two constants c 1, c 2 and a threshold n 0 such that 2 c 1 f (n) g(n) c 2 f (n) for all n larger than n 0 Hao Chung (NTU) crypto July 17, 2017 13 / 21

Big-Oh Examples Example Let f (n) = n 4 + 3n + 500. Prove f (n) Ω(n 3 log n). Prove f (n) = Θ(n 4 ). Example Prove log n O(n k ), k > 0. Example Prove n k O(n log n ), k > 0. Example Let f (n) = n log n and n1 δ, where δ (0, 1). Prove f (n) O(g(n)) or g(n) O(f (n)). Hao Chung (NTU) crypto July 17, 2017 14 / 21

Outline 1 Big-Oh notation 2 Probabilistic Polynomial-Time (PPT) 3 P vs NP Hao Chung (NTU) crypto July 17, 2017 15 / 21

Probabilistic Polynomial-Time (PPT) In cryptography, we usually define the power of adversary as a probabilistic polynomial-time (PPT) algorithm. An algorithm is polynomial-time if its running time is O(n k ) for some k. An algorithm is probabilistic (or randomized) if we allow the algorithm to toss a coin at each step. Example (Primality-Test) 1 randomly choose a {2,, N 1} 2 if a N 1 1, output N is composite 3 run step 1 and step 2 many times 4 if none of a N 1 1 in previous steps, output N is likely a prime Hao Chung (NTU) crypto July 17, 2017 16 / 21

Outline 1 Big-Oh notation 2 Probabilistic Polynomial-Time (PPT) 3 P vs NP Hao Chung (NTU) crypto July 17, 2017 17 / 21

P vs NP Definition P is a set of problems that can be solved in polynomial time. Definition NP is a set of problems that can be checked in polynomial time given a solution. Hao Chung (NTU) crypto July 17, 2017 18 / 21

Polynomial-Time Reduction Problem A is polynomial-time reducible to problem B if 1 given an oracle for B 2 A can be solved in polynomial-time We write A p B to denote that A is polynomial-time reducible to B. Hao Chung (NTU) crypto July 17, 2017 19 / 21

Factoring is Reducible to Order-Finding If we have then If r is even, we have a r 1 (mod N), N a r 1. N (a r/2 1)(a r/2 + 1). It cannot happen that N (a r/2 1), because this would mean that r was not the order of a. If N (a r/2 + 1), then gcd(n, a r/2 + 1) is a non-trivial factor for N. Theorem If a is chosen randomly from ZN, and r is the order of a, then Pr[r is even N (a r/2 + 1)] 1 2. Hao Chung (NTU) crypto July 17, 2017 20 / 21

Hao Chung (NTU) crypto July 17, 2017 21 / 21