Cpt S 223 – Advanced Data Structures Math Review 2

Slides:



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

Analysis of Algorithms
Thinking Mathematically
CSE115/ENGR160 Discrete Mathematics 03/13/12 Ming-Hsuan Yang UC Merced 1.
11 Computer Algorithms Lecture 6 Recurrence Ch. 4 (till Master Theorem) Some of these slides are courtesy of D. Plaisted et al, UNC and M. Nicolescu, UNR.
CSC2110 Discrete Mathematics Tutorial 5 GCD and Modular Arithmetic
1 Data Structures A program solves a problem. A program solves a problem. A solution consists of: A solution consists of:  a way to organize the data.
Section Section Summary Recursive Algorithms Proving Recursive Algorithms Correct Recursion and Iteration (not yet included in overheads) Merge.
Discrete Structures Chapter 5: Sequences, Mathematical Induction, and Recursion 5.2 Mathematical Induction I [Mathematical induction is] the standard proof.
Induction and recursion
BY MISS FARAH ADIBAH ADNAN IMK
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved. CHAPTER 11 ANALYSIS OF ALGORITHM EFFICIENCY ANALYSIS OF ALGORITHM EFFICIENCY.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 3 (Part 2): The Fundamentals: Algorithms, the.
Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
Mathematics of Cryptography Part I: Modular Arithmetic
Sequences and Series (T) Students will know the form of an Arithmetic sequence.  Arithmetic Sequence: There exists a common difference (d) between each.
Sequences and Series It’s all in Section 9.4a!!!.
MATH 224 – Discrete Mathematics
1 CS 201 Data Structures & Algorithms Chapter 1 Introduction Text: Read Weiss, §1.1 – 1.3 Izmir University of Economics.
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
Chapter 2 - Mathematical Review Functions
1 CE 221 Data Structures & Algorithms Chapter 1 Introduction Text: Read Weiss, §1.1 – 1.3 Izmir University of Economics.
Advance Data Structure and Algorithm COSC600 Dr. Yanggon Kim Chapter 1.
Chapter 1 Introduction. Goals Why the choice of algorithms is so critical when dealing with large inputs Basic mathematical background Review of Recursion.
Data Structures and Algorithms Discrete Math Review.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Review Midterm.
Discrete Mathematics Math Review. Math Review: Exponents, logarithms, polynomials, limits, floors and ceilings* * This background review is useful for.
Chapter 2 Mathematical preliminaries 2.1 Set, Relation and Functions 2.2 Proof Methods 2.3 Logarithms 2.4 Floor and Ceiling Functions 2.5 Factorial and.
Sequences and Summations
Fundamentals CSE 373 Data Structures Lecture 5. 12/26/03Fundamentals - Lecture 52 Mathematical Background Today, we will review: ›Logs and exponents ›Series.
CMPT 438 Algorithms Chapter 3 Asymptotic Notations.
Divide & Conquer  Themes  Reasoning about code (correctness and cost)  recursion, induction, and recurrence relations  Divide and Conquer  Examples.
By Sheldon, Megan, Jimmy, and Grant..  Sequence- list of numbers that usually form a pattern.  Each number in the list is called a term.  Finite sequence.
Mathematical Background and Linked Lists. 2 Iterative Algorithm for Sum Find the sum of the first n integers stored in an array v : sum (v[], n) temp_sum.
Chapter 2 (Part 1): The Fundamentals: Algorithms, the Integers & Matrices The Integers and Division (Section 2.4)
Elements of Coding and Encryption 1. Encryption In the modern word, it is crucial that the information is transmitted safely. For example, Internet purchases,
Chapter 1: Introduction
Module #9 – Number Theory 1/5/ Algorithms, The Integers and Matrices.
Great Theoretical Ideas in Computer Science for Some.
October 3, 2001CSE 373, Autumn Mathematical Background Exponents X A X B = X A+B X A / X B = X A-B (X A ) B = X AB X N +X N = 2X N 2 N +2 N = 2 N+1.
ADVANCED ALGORITHMS REVIEW OF ANALYSIS TECHNIQUES (UNIT-1)
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Math Review 1.
Copyright © Cengage Learning. All rights reserved. CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF ELEMENTARY NUMBER THEORY AND METHODS OF PROOF.
Divide and Conquer Faculty Name: Ruhi Fatima Topics Covered Divide and Conquer Matrix multiplication Recurrence.
1 CMSC 341 Math Review. 2 Exponents Identities (X A ) B = X AB X A * X B = X A+B X A / X B = X A-B X A + X B  X A+B.
1 2/21/2016 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Divide & Conquer Themes –Reasoning about code (correctness and cost) –iterative code, loop invariants, and sums –recursion, induction, and recurrence relations.
Chapter 13 Mathematic Structures 13.1 Modular Arithmetic Definition 1 (modulo). Let a be an integer and m be a positive integer. We denoted by a mod m.
Great Theoretical Ideas In Computer Science COMPSCI 102 Fall 2010 Lecture 16October 27, 2010Duke University Modular Arithmetic and the RSA Cryptosystem.
TCSS 342 Autumn 2004 Version TCSS 342 Data Structures & Algorithms Autumn 2004 Ed Hong.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 3. Mathematics of Cryptography.
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.
Discrete Mathematics Chapter 2 The Fundamentals : Algorithms, the Integers, and Matrices. 大葉大學 資訊工程系 黃鈴玲.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Recursive Algorithms Section 5.4.
MATH 224 – Discrete Mathematics
Modular Arithmetic with Applications to Cryptography
Modeling with Recurrence Relations
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Direct Proof and Counterexample V: Floor and Ceiling
CSE 373 Data Structures Lecture 5
CMSC 341 Math Review.
CE 221 Data Structures & Algorithms Chapter 1 Introduction
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
Presentation transcript:

Cpt S 223 – Advanced Data Structures Math Review 2 Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University

Why do we need math in a data structures course? Analyzing data structures and algorithms Deriving formulae for time and memory requirements Will the solution scale? Proving algorithm correctness similar to proving a mathematical theorem; fundamentally, it is algorithm-dependent to prove the incorrectness of an algorithm, one counter-example is enough

Floors and Ceilings Floor operation Ceiling operation Denoted: floor(x) or x Greatest integer less than or equal to x E.g. floor(5.4) = ?, floor(5.9) = ? E.g. floor(-5.4) = ?, floor(-5.9) = ? Ceiling operation Denoted: ceiling(x) or x Smallest integer greater than or equal to x E.g. ceiling(5.4) = ?, ceiling(5.9) = ? E.g. ceiling(-5.4) = ?, ceiling(-5.9) = ?

Floors and Ceilings (cont’d) floor(x), denoted , is the greatest integer ≤ x ceiling(x), denoted , is the smallest integer ≥ x Normally used to divide input into integral parts

Exponents Written xa, involving two numbers, x and a x is the base a is the exponent If a is a positive integer xa = x  x  …  x (a times) xn read as “x raised to the n-th power” “x raised to the power n” “x raised to the exponent n” “x to the n”

Exponents (cont’d) x0 = 1, x  0 x-n = 1/xn, x  0 xa  xb = x(a+b) xa / xb = x(a-b), x  0 (xa)b = xab (xy)a = xa  ya xn + xn = 2xn  x2n 2n + 2n = 2n+1

Logarithm Definition xa = b if and only if logx b = a logx b read as “logarithm of b to the base x” The power or exponent to which the base x must be raised in order to produce b E.g. log10 1000 = 3 E.g. log2 32 = 5 Only positive real numbers have real number logarithms

Logarithm (cont’d) Rules of logarithms loga b = logc b / logc a, s.t. a, b, c > 0, a  1 Proof: will be derived in the class Useful for computing the logarithm of a number to an arbitrary base using the calculator In computer science, log a = log2 a (unless specified otherwise)

Logarithm (cont’d) Rules of logarithms log (ab) = log a + log b, a, b > 0 Proof: will be derived in the class log (a/b) = log a – log b log (ab) = b log a log x < x for all x > 0 log 1 = 0 log 2 = 1 log 1,024 = 10 log 1,048,576 = 20 lg a = log2 a How many times to halve an array of length n until its length is 1? ln a = loge a where e = 2.7182… ln: natural logarithm

Factorials Denoted: n! Read: “n factorial” Definition: n! < nn n! = 1 if n = 0 = n (n – 1)! If n > 0 n! < nn How many different ways of arranging n distinct object into a sequence (called permutation of those objects)? n!

Series General Linearity

Arithmetic Series How many nodes are there in a complete binary tree of depth D? 15 22 27 19 10 12 3

Geometric Series Geometric series Proof: will be derived in the class Example: Compute

Modular Arithmetic A is congruent to B modulo N, written as A  B (mod N) if N divides (A – B). This means that the remainder is the same when either A or B is divided by N. (A mod N) = (B mod N) => A  B (mod N) E.g., Note: A mod N = A – N * A / N This is the remainder

Modular Arithmetic (cont’d) Example: 104  79  4 (mod 25) 33  3 (mod 10) If A  B (mod N) Then (A + C)  (B + C)(mod N) and AD  BD (mod N) Application: Basis of most encryption schemes: (Message mod Key)

Summary Math Review Proof Techniques Recursion Proof by induction Proof by contradiction Proof by counterexample Recursion Exponents, logarithm, arithmetic series, geometric series, modular arithmetic etc

Questions ?