cse101 design and analysis of algorithms
play

CSE101: Design and Analysis of Algorithms Ragesh Jaiswal, CSE, UCSD - PowerPoint PPT Presentation

CSE101: Design and Analysis of Algorithms Ragesh Jaiswal, CSE, UCSD Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms Administrative Information Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms


  1. CSE101: Design and Analysis of Algorithms Ragesh Jaiswal, CSE, UCSD Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  2. Administrative Information Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  3. Administrative Information Course Instructor: Ragesh Jaiswal Office: 3130, CSE Email : rajaiswal@ucsd.edu Course webpage: http://www.cs.ucsd.edu/~rajaiswal/Winter2020/cse101/ . The discussion sections will be held this week. We will recap. material from the previous courses that will be used in this course. The first lecture is being conducted by Prof. Russell Impagliazzo . The detailed administrative information will be discussed in the second lecture by the course instructor. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  4. Recap. of Data Structures and Algorithms Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  5. Recap. What is an algorithm? Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  6. Recap. What is an algorithm? A step-by-step way of solving a problem. How do we measure the performance of an algorithm? Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  7. Recap. What is an algorithm? A step-by-step way of solving a problem. How do we measure the performance of an algorithm? Main ideas for performance measurement: Worst-case analysis: Largest possible running time over all input instances of a given size n and then see how this function scales with n . Asymptotic order of growth: The worst-case running time for large n (e.g., T ( n ) = 5 n 3 + 3 n 2 + 2 n + 10) Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  8. Recap. What is an algorithm? A step-by-step way of solving a problem. How do we measure the performance of an algorithm? Main ideas for performance measurement: Worst-case analysis: Largest possible running time over all input instances of a given size n and then see how this function scales with n . Asymptotic order of growth: The worst-case running time for large n (e.g., T ( n ) = 5 n 3 + 3 n 2 + 2 n + 10) Figure: Plot of n 2 and 2 n + 2 Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  9. Recap. What is an algorithm? A step-by-step way of solving a problem. How do we measure the performance of an algorithm? Main ideas for performance measurement: Worst-case analysis: Largest possible running time over all input instances of a given size n and then see how this function scales with n . Asymptotic order of growth: The worst-case running time for large n (e.g., T ( n ) = 5 n 3 + 3 n 2 + 2 n + 10) Asymptotic order of growth ( O , Ω , Θ): T ( n ) is O ( f ( n )) (or T ( n ) = O ( f ( n ))) iff there exists constants c > 0 , n 0 ≥ 0 such that for all n ≥ n 0 , we have T ( n ) ≤ c · f ( n ). Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  10. Recap. Growth rates: Arrange the following functions in ascending order of growth rate: n √ log n 2 n log n 2 log n n / log n n n Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  11. Introduction Algorithm: A step-by-step way of solving a problem. Design of Algorithms: “Algorithm is more of an art than science” However, we will learn some basic tools and techniques that have evolved over time. These tools and techniques enable you to effectively design and analyse algorithms. Analysis of Algorithms: Proof of correctness: An argument that the algorithm works correctly for all inputs. Analysis of worst-case running time as a function of the input size. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  12. Introduction Algorithm: A step-by-step way of solving a problem. Design of Algorithms: “Algorithm is more of an art than science” However, we will learn some basic tools and techniques that have evolved over time. These tools and techniques enable you to effectively design and analyse algorithms. Analysis of Algorithms: Proof of correctness: An argument that the algorithm works correctly for all inputs. Proof: A valid argument that establishes the truth of a mathematical statement. Analysis of worst-case running time as a function of the input size. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  13. Introduction Proof: A valid argument that establishes the truth of a mathematical statement. The statements used in a proof can include axioms, definitions, the premises, if any, of the theorem, and previously proven theorems and uses rules of inference to draw conclusions. A proof technique very commonly used when proving correctness of Algorithms is Mathematical Induction . Definition (Strong Induction) To prove that P ( n ) is true for all positive integers, where P ( n ) is a propositional function, we complete two steps: Basis step: We show that P (1) is true. Inductive step: We show that for all k , if P (1) , P (2) , ..., P ( k ) are true, then P ( k + 1) is true. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  14. Introduction Definition (Strong Induction) To prove that P ( n ) is true for all positive integers, where P ( n ) is a propositional function, we complete two steps: Basis step: We show that P (1) is true. Inductive step: We show that for all k , if P (1) , P (2) , ..., P ( k ) are true, then P ( k + 1) is true. Question: Show that for all n > 0, 1 + 3 + ... + (2 n − 1) = n 2 . Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  15. Introduction Question: Show that for all n > 0, 1 + 3 + ... + (2 n − 1) = n 2 . Proof Let P ( n ) be the proposition that 1 + 3 + 5 + ... + (2 n − 1) equals n 2 . Basis step: P (1) is true since the summation consists of only a single term 1 and 1 2 = 1. Inductive step: Assume that P (1) , P (2) , ..., P ( k ) are true for any arbitrary integer k . Then we have: 1 + 3 + ... + (2( k + 1) − 1) = 1 + 3 + ... + (2 k − 1) + (2 k + 1) k 2 + 2 k + 1 = (since P ( k ) is true) ( k + 1) 2 = This shows that P ( k + 1) is true. Using the principle of Induction, we conclude that P ( n ) is true for all n > 0. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  16. Introduction Algorithm: A step-by-step way of solving a problem. Design of Algorithms: “Algorithm is more of an art than science” However, we will learn some basic tools and techniques that have evolved over time. These tools and techniques enable you to effectively design and analyse algorithms. Analysis of Algorithms: Proof of correctness: An argument that the algorithm works correctly for all inputs. Proof: A valid argument that establishes the truth of a mathematical statement. Analysis of worst-case running time as a function of the input size. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  17. Introduction Algorithm Design Techniques Divide and Conquer Greedy Algorithms Dynamic Programming Network Flows Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  18. Introduction Material that will be covered in the course: Basic graph algorithms Algorithm Design Techniques Divide and Conquer Greedy Algorithms Dynamic Programming Network Flows Computational intractability Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  19. Introduction Divide and Conquer Some examples of Divide and Conquer Algorithms: Binary Search Median finding Multiplying numbers Merge sort, quick sort. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  20. Introduction Greedy Algorithms Problem Interval scheduling: You have a lecture room and you get n requests for scheduling lectures. Each request has a start time and an end time. The goal is to maximise the number of lectures. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  21. Introduction Dynamic Programming Problem Interval scheduling: You have a lecture room and you get n requests for scheduling lectures. Each request has a start time, an end time, and a price (that you will get in case the lecture is scheduled). The goal is to maximise your earnings. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  22. Introduction Network Flows Problem Job assignment: There are n people and n jobs. Each person has a list of jobs he/she could possibly do. Find a job assignment so that: 1 each job is assigned to a different person, and 2 each person is assigned a job from his/her list. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

  23. Introduction Computational Intractability Is it always possible to find a fast algorithm for any problem? Problem Given a social network, find the largest subset of people such that no two people in the subset are friends. Ragesh Jaiswal, CSE, UCSD CSE101: Design and Analysis of Algorithms

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend