Great Theoretical Ideas in Computer Science

Slides:



Advertisements
Similar presentations
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.3 Basic Number Theory.
Advertisements

Primality Testing Patrick Lee 12 July 2003 (updated on 13 July 2003)
Chapter Primes and Greatest Common Divisors ‒Primes ‒Greatest common divisors and least common multiples 1.
Ancient Wisdom: Primes, Continued Fractions, The Golden Ratio, and Euclid’s GCD Great Theoretical Ideas In Computer Science Anupam GuptaCS Fall.
Factors, Fractions, and Exponents
Elementary Number Theory and Methods of Proof. Basic Definitions An integer n is an even number if there exists an integer k such that n = 2k. An integer.
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
Great Theoretical Ideas in Computer Science.
College Algebra Fifth Edition
WHOLE NUMBERS; INTEGERS Whole numbers: Z 0,+ = the natural numbers  {0}. Integers:
Great Theoretical Ideas in Computer Science for Some.
Great Theoretical Ideas in Computer Science.
Introduction Dr. Ying Lu RAIK 283: Data Structures & Algorithms.
Great Theoretical Ideas in Computer Science.
Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
Sequences Informally, a sequence is a set of elements written in a row. – This concept is represented in CS using one- dimensional arrays The goal of mathematics.
COMP 170 L2 Page 1 L05: Inverses and GCDs l Objective: n When does have an inverse? n How to compute the inverse? n Need: Greatest common dividers (GCDs)
MATH 224 – Discrete Mathematics
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
Information Security and Management 4. Finite Fields 8
Extended Euclidean Algorithm Presented by Lidia Abrams Anne Cheng.
Chapter 3 (Part 3): Mathematical Reasoning, Induction & Recursion  Recursive Algorithms (3.5)  Program Correctness (3.6)
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 4 (Part 3): Mathematical Reasoning, Induction.
Review Introduction to Searching External and Internal Searching Types of Searching Linear or sequential search Binary Search Algorithms for Linear Search.
1 Introduction to Abstract Mathematics Chapter 3: Elementary Number Theory and Methods of Proofs Instructor: Hayk Melikya Direct.
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
Chapter 4 – Finite Fields
1 Section 2.1 Functions: Definitions and Examples A function ƒ from A to B associates each element of A with exactly one element of B. Write ƒ : A  B.
CSE 311: Foundations of Computing Fall 2014 Lecture 12: Primes, GCD.
CS/ECE Advanced Network Security Dr. Attila Altay Yavuz
COMPSCI 102 Introduction to Discrete Mathematics.
MA/CSSE 473 Day 08 Extended Euclid's Algorithm Modular Division Fermat's little theorem.
CS404 Design and Analysis of Algorithms BBy DDr. M V S Peri Sastry BB.E, PhD(BITS-Pilani)
Application: Algorithms Lecture 20 Section 3.8 Wed, Feb 21, 2007.
Lesson 2-5. Refresher Simplify the following expressions
Application: Algorithms Lecture 19 Section 3.8 Tue, Feb 20, 2007.
Chapter 1 Algorithms with Numbers. Bases and Logs How many digits does it take to represent the number N >= 0 in base 2? With k digits the largest number.
Chapter 4 With Question/Answer Animations 1. Chapter Summary Divisibility and Modular Arithmetic - Sec 4.1 – Lecture 16 Integer Representations and Algorithms.
Slide Copyright © 2009 Pearson Education, Inc. Slide Copyright © 2009 Pearson Education, Inc. Chapter 1 Number Theory and the Real Number System.
Great Theoretical Ideas in Computer Science.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Agenda Review:  Relation Properties Lecture Content:  Divisor and Prime Number  Binary, Octal, Hexadecimal Review & Exercise.
Simplifying Rational Expressions.
Discrete Math II Howon Kim
Recursion The programs discussed so far have been structured as functions that invoke one another in a disciplined manner For some problems it is useful.
Chapter 4 (Part 3): Mathematical Reasoning, Induction & Recursion
AIM: How do we simplify, multiply and divide rational expressions?
Administrative Details
MA/CSSE 473 Day 06 Euclid's Algorithm.
Simplifying Rational Expressions. Simplifying Rational Expressions.
Advanced Algorithms Analysis and Design
Reducing a Fraction to Its Simplest Form
Number-Theoretic Algorithms (UNIT-4)
Number Theory and Modular Arithmetic
Numerical Algorithms x x-1
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Number Theory (Chapter 7)
Great Theoretical Ideas in Computer Science
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
Simplifying Rational Expressions.
Great Theoretical Ideas In Computer Science
Warm-Up (Fractions) Calculator Free. [1] [2] [3] [4]
Simplifying Rational Expressions.
Simplifying Rational Expressions.
Application: Algorithms
Application: Algorithms
Greatest Common Divisor.
Patrick Lee 12 July 2003 (updated on 13 July 2003)
Section 7.2 Adding and Subtracting Rational Expressions.
Multiply whole number with rational number
Presentation transcript:

Great Theoretical Ideas in Computer Science 15-251 Some Great Theoretical Ideas in Computer Science for

Rules of the Game Each person will have a unique number For each question, I will first give the class time to work out an answer. Then, I will call three different people at random They must explain the answer to the TAs (who are all the way in the back). If the TAs are satisfied, the class gets points. If the class gets 1,700 points, then you win

AN RUNNING TIME ALGORITHM ALGO CONVER- PROPERTIES GENTS GCD ALGORITHM 400 400 AN ALGORITHM RUNNING TIME 300 300 ALGO PROPERTIES CONVER- GENTS 200 200 GCD ALGORITHM EXAMPLES 100 100 GCD DEFINITION CONTINUED FRACTIONS

1. The Greatest Common Divisor (GCD) of two non-negative integers A and B is defined to be: The largest positive integer that divides both A and B 2. As an example, what is GCD(12,18) and GCD(5,7) GCD(12,18) = 6 GCD(5,7)=1

A Naïve method for computing GCD(A,B) is: Factor A into prime powers. Factor B into prime powers. Create GCD by multiplying together each common prime raised to the highest power that goes into both A and B. Give an algorithm to compute GCD(A,B) that does not require factoring A and B into primes, and does not simply try dividing by most numbers smaller than A and B to find the GCD. Run your algorithm to calculate GCD(67,29) Euclid(A,B) = Euclid(B, A mod B) Stop when B=0

Euclid’s GCD algorithm can be expressed via the following pseudo-code: Euclid(A,B) If B=0 then return A else return Euclid(B, A mod B) Show that if this algorithm ever stops, then it outputs the GCD of A and B GCD(A,B) = GCD(B, A mod B) Proof: ( d | A and d | B )  ( d | (A - kB ) and d | B ) The set of common divisors of A, B equals the set of common divisors of B, A - kB

Euclid(A,B) = Euclid(B, A mod B) Stop when B=0 Show that the running time for this algorithm is bounded above by 2log2(max(A,B)) Claim: A mod B < ½ A Proof: If B = ½ A then A mod B = 0 If B < ½ A then any X Mod B < B < ½ A If B > ½ A then A mod B = A - B < ½ A Proof of Running Time: GCD(A,B) calls GCD(B, <½A) which calls GCD(<½A, B mod <½A) Every two recursive calls, the input numbers drop by half

DAILY DOUBLE

A simple continued fraction is an expression of the form: b + c + d + e + … 1 Where a,b,c,d,e, … are non-negative integers. We denote this continued fraction by [a,b,c,d,e,…]. What number do the fractions [3,2,1,0,0,0,…] (= [3,2,1]) and [1,1,1,0,0,0,…] (= [1,1,1]) represent? (simplify your answer)

Let r1 = [1,0,0,0,…] r2 = [1,1,0,0,0,…] r3 = [1,1,1,0,0,0…] r4 = [1,1,1,1,0,0,0…] : Find a the value of rn as a ratio of somethig we’ve seen before (prove your answer) rn = Fib(n+1)/F(n) Fib(n+1) Fib(n) Fib(n)+Fib(n-1) Fib(n) = 1 + 1 Fib(n) Fib(n-1) =

Let  = [a1, a2, a3, ...] be a continued fraction Define: C1 = [a1,0,0,0,0..] C2 = [a1,a2,0,0,0,...] C3 = [a1,a2,a3,0,0,...] : Ck is called the k-th convergent of   is the limit of the sequence C1, C2, C3,… A rational p/q is the best approximator to a real  if no rational number of denominator smaller than q comes closer to  Given any CF representation of , each con-vergent of the CF is a best approximator for 

Find best approximators for  with denominators 1, 7 and 113 C1 = 3 C2 = 22/7 C3 = 333/106 C4 = 355/113 C5 = 103993/33102 C6 =104348/33215

1. Write a continued fraction for 67/29 2 + 3 + 4 + 2 1 2. Write a formula that allows you to calculate the continued fraction of A/B in 2log2(max(A,B)) steps