CSE 220 (Data Structures and Analysis of Algorithms) Instructor: Saswati Sarkar T.A. Dimosthenes Anthomelidis

Slides:



Advertisements
Similar presentations
Lecture 2 Based on Chapter 1, Weiss. Mathematical Foundation Series and summation: ……. N = N(N+1)/2 (arithmetic series) 1 + r+ r 2 + r 3 +………r.
Advertisements

CSE 311 Foundations of Computing I Spring 2013 Lecture 1 Propositional Logic.
Week 5 - Friday.  What did we talk about last time?  Sequences  Summation and production notation  Proof by induction.
January 5, 2015CS21 Lecture 11 CS21 Decidability and Tractability Lecture 1 January 5, 2015.
COMP171 Data Structures and Algorithms Spring 2009.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Midterm Review Fri. Oct 26.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 3 Recurrence equations Formulating recurrence equations Solving recurrence equations.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 3 Recurrence equations Formulating recurrence equations Solving recurrence equations.
Administrivia- Introduction CSE 373 Data Structures.
COMP171 Data Structures and Algorithm Huamin Qu Lecture 1 (Sept. 1, 2005)
COMP171 Data Structures and Algorithm Qiang Yang Lecture 1 ( Fall 2006)
EE 220 (Data Structures and Analysis of Algorithms) Instructor: Saswati Sarkar T.A. Prasanna Chaporkar, Programming.
CENG 213 Data Structures Department of Computer Engineering Middle East Technical University Fall 2014 CENG 213 Data Structures 1.
CSCE 3110 Data Structures and Algorithm Analysis.
Data Structures & Agorithms Lecture-1: Introduction.
METU Computer Engineering Department
Instructor: Dr. Sahar Shabanah Fall Lectures ST, 9:30 pm-11:00 pm Text book: M. T. Goodrich and R. Tamassia, “Data Structures and Algorithms in.
Nattee Niparnan Dept. of Computer Engineering, Chulalongkorn University.
© 2004 Goodrich, Tamassia CS2210 Data Structures and Algorithms Lecture 1: Course Overview Instructor: Olga Veksler.
MATH 224 – Discrete Mathematics
CS223 Algorithms D-Term 2013 Instructor: Mohamed Eltabakh WPI, CS Introduction Slide 1.
David Luebke 1 9/11/2015 CS 332: Algorithms Introduction Proof By Induction.
Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
CSE373: Data Structures and Algorithms Lecture 2b: Proof by Induction and Powers of Two Nicki Dell Spring 2014.
1 CE 221 Data Structures & Algorithms Chapter 1 Introduction Text: Read Weiss, §1.1 – 1.3 Izmir University of Economics.
COMPE 226 Data Structures 2015 Fall Murat KARAKAYA Department of Computer Engineering.
CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.
Chapter 1 Introduction. Goals Why the choice of algorithms is so critical when dealing with large inputs Basic mathematical background Review of Recursion.
COMPE 574 Fundamentals of Algorithms Spring Murat KARAKAYA Department of Computer Engineering.
Sequences and Summations
A Lecture /24/2015 COSC3101A: Design and Analysis of Algorithms Tianying Ji Lecture 1.
COT 5405 Spring 2009 Discussion Session 3. Introduction Our weekly discussion class are like organized TA office hours. Here we encourage students to.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Introduction.
CSE 3358 NOTE SET 1 Data Structures and Algorithms.
INTRODUCTION. What is an algorithm? What is a Problem?
December 4, Algorithms and Data Structures Lecture XV Simonas Šaltenis Aalborg University
Basic Mathematics Chapter 1 (1.2 and 1.3) Weiss. Recursion / Slide 2 Logarithms * Definition: if and only if * Theorem 1.1: n Proof: apply the definition.
+ David Kauchak cs312 Review. + Midterm Will be posted online this afternoon You will have 2 hours to take it watch your time! if you get stuck on a problem,
Math & Recursion COMP171 Fall Recursion / Slide 2 Logarithms * Definition: if and only if * Theorem 1.1: n Proof: apply the definition * Theorem.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 1.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Introduction.
Data Structures and Algorithm Analysis Introduction Lecturer: Ligang Dong, egan Tel: , Office: SIEE Building.
1 BIM304: Algorithm Design Time: Friday 9-12am Location: B4 Instructor: Cuneyt Akinlar Grading –2 Midterms – 20% and 30% respectively –Final – 30% –Projects.
+ David Kauchak cs312 Review. + Midterm Will be posted online this afternoon You will have 2 hours to take it watch your time! if you get stuck on a problem,
Course Review Fundamental Structures of Computer Science Margaret Reid-Miller 29 April 2004.
Design and Analysis of Algorithms (09 Credits / 5 hours per week) Sixth Semester: Computer Science & Engineering M.B.Chandak
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Math Review 1.
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction Linda Shapiro Winter 2015.
CES 592 Theory of Software Systems B. Ravikumar (Ravi) Office: 124 Darwin Hall.
CMPT 308 — Computability and Complexity Fall 2004 Instructor: Andrei Bulatov, TA: Ramsay Dyer, Learning.
Course Info Instructor U.T. Nguyen Office: CSEB Office hours: Tuesday, 14:30-15:30 Thursday, 12:00-12:45 By.
Data Structures and Algorithms in Java AlaaEddin 2012.
2IL50 Data Structures Spring 2016 Lecture 2: Analysis of Algorithms.
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.
TCSS 342 Autumn 2004 Version TCSS 342 Data Structures & Algorithms Autumn 2004 Ed Hong.
CS16: Introduction to Algorithms and Data Structures
MATH 224 – Discrete Mathematics
Lecture 1 Introduction/Overview Text: Chapters 1, 2 Wed. 1/28/04
MA/CSSE 473 Day 02 Some Numeric Algorithms and their Analysis
Definition In simple terms, an algorithm is a series of instructions to solve a problem (complete a task) We focus on Deterministic Algorithms Under the.
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction
Introduction CSE 373 Data Structures.
Administrivia- Introduction
COMPSCI 330 Design and Analysis of Algorithms
Administrivia- Introduction
Richard Anderson Winter 2019 Lecture 2
INTRODUCTION TO ALOGORITHM DESIGN STRATEGIES
Department of Computer Science & Engineering
Presentation transcript:

CSE 220 (Data Structures and Analysis of Algorithms) Instructor: Saswati Sarkar T.A. Dimosthenes Anthomelidis Course Web Page:

Timings Class MWF: 12-1, 224 Moore Instructor Office Hours: 11-12, Friday, 360 Moore (correction) 1-2 Wednesday 360 Moore T.A. Office Hours: Monday 11-12, Friday 1-2, 329 Pender Recital: Wednesday 5-6 (Moore 216)

Text Books Data Structures and Algorithm Analysis in C Mark Allen Weiss Data Structures Using C Yedidyah Langsam

Prerequisites Knowledge of C CSE 260?

Grading Weekly Homeworks (30%) Posted every Monday Due Next Monday before class (solution posted after class) No consultation allowed No late submission accepted First Homework will be posted on 29 th January

Cumulative Final: 40% 1 Midterm: 30% (last class before spring break)

Course Content Course Motivation Mathematical Foundation: Complexity Analysis: Data Structures: List, Stacks, Queues Algorithm: Searching and Trees Sorting and Heaps Graph Algorithms (Depth first Search, Breadth First Search, Topological sort, Shortest path algorithm, Spanning Tree Algorithm) Computability and Complexity

2 review lectures No class on April 25 No class on either April 23 or April 27 (will confirm later)

Course Motivattion Need to run computer programs efficiently! Computer program: Accepts Input (Data) Performs a Sequence of action with the input Generates Output (Data) Efficient Management of Data (Data Structures) Efficient Sequence of Actions Algorithms

Sequence of actions a ``dumb’’ machine can follow For j=1 to N print j Efficient versus Inefficient algorithm Linear Search Vs Binary Search

Design of Algorithms You have a problem to solve Design an efficient algorithm Use good data structures Show that your algorithm works! Prove its correctness Study the efficiency of your algorithm

Formal Study of Algorithms Design of Algorithms Proving Correctness of Algorithms Formal study of efficiency of algorithms Run time Storage required

Mathematical Foundation Series and summation: ……. N = N(N+1)/2 (arithmetic series) 1 + r 2 + r 3 +………r N-1 = (1- r N )/(1-r), (geometric series)  1/(1-r), r < 1, large N Sum of squares: ………N 2 = N(N + 1)(2N + 1)/6

Properties of a log Function log x a = b if x b = a (we will use base 2 mostly, but may use other bases occasionally) Will encounter log functions again and again! log n bits needed to encode n messages. log (ab ) = log a + log b log (a/b ) = log a - log b log a b = b log a log b a = log c a/ log c b a log n = n log a

a mn = (a m ) n = (a n ) m a m+n = a m a n (2  n) 0.5 (n/e) n  n   (2  n) 0.5 (n/e) n + (1/12n)

We will deduce the value of the descending geometric series: N + Nr + Nr 2 + Nr 3 +………1 Example: N + N/2 + N/4 + …… + 1 The summation equals (N-r)/(1-r) For r = 2, this is 2N - 1

Proof By Induction Prove that a property holds for input size 1 Assume that the property holds for input size 1,2,…n. Show that the property holds for input size n+1. Then, the property holds for all input sizes, n.

Prove that the sum of 1+2+…..+n = n(n+1)/2 Holds for n = 1 Let it hold for 1,2…..n 1+2+….+n = n(n+1)/2 1+2+….+n+(n+1) = n(n+1)/2 + (n+1) = (n+1)(n+2)/2.

Fibonacci Numbers Sequence of numbers, F 0 F 1, F 2, F 3,……. F 0 = 1, F 1 = 1, F 2 = 2, F 3 = 3,……. F i = F i-1 + F i-2,

Will prove that F N <  N  = (1+sqrt(5))/2  i=1 N-2 F i = F N - 2 N > 2 (Correction) Holds for N = 1 Let it hold for 1,2,….N F N+1 = F N + F N-1 <  N +  N-1 =  N-1 (1 +  ) =  N-1  2 =  N+1

Proof By Counter Example Want to prove something is not true! Give an example to show that it does not hold! Is F N  N 2 ? No, F 11 = 144 However, if you were to show that F N  N 2 then you need to show for all N, and not just one number.

Proof By Contradiction Suppose, you want to prove something. Assume that what you want to prove does not hold. Then show that you arrive at an impossiblity. Example: The number of prime numbers is not finite!

Suppose there are finite number of primes, k primes. (we do not include 1 in primes here) We know k  2. Let the primes be P 1, P 2, ……… P k Z = P 1 P 2 ……… P k + 1 Z is not divisible by P 1, P 2, ……… P k Z is greater than P 1, P 2, ……… P k Thus Z is not a prime. We know that a number is either prime or divisible by primes. Hence contradiction. So our assumption that there are finite number of primes is not true.