1 / 25

Introduction

Introduction. What is an algorithm?. A precise instruction based on elementary operation Which takes something as input and process it into output to solve some problems. What is a Problem?. A task with precise description of admissible input and the “property” of the desired output

toviel
Download Presentation

Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction

  2. What is an algorithm? • A precise instruction based on elementary operation • Which takes something as input and process it into output • to solve some problems

  3. What is a Problem? • A task with precise description of admissible input • and the “property” of the desired output • E.g., GCD • Given two positive integers (input) • Determine GCD of the given integers • (express the property of the desired output) • GCD is well defined

  4. Problem Instance • Determining GCD is a problem • How many actual problems? • GCD of 1 and 2 ? • GCD of 234 and 42? • More? Obviously yes. • Problem instance • A problem with a specific input • E.g., find a GCD of 42 and 14

  5. Purpose of this class • “how to design algorithms for given problems, and beyond” • Analysis • Synthesis  emphasized in this class • Algorithm should be • Correct • For any instances, it must produce appropriate output • Efficient • Use not too much resource

  6. Calculating Fibonacci Sequence • Fibonacci sequence • 1, 1, 2, 3, 5, 7, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584

  7. The Problem • Input: • a positive number N • Output: • Fn (the nth Fibonacci Number) • Example instances • Ex. 1: N = 10 • Ex. 2: N = 15 • Ex. 3: N = 0 N = -4 is not an instances of this problem!!!

  8. Approach 1 • Array based • method: dynamic programming on linear structure (linear time)

  9. Approach 2 • method: Recursive (exponential time) F(9) F(8) F(7) F(7) F(6) F(6) F(5) … … … …

  10. Approach 3 • Method: Divide and Conquer (logarithmic)

  11. Approach 3 • Find exponential • Method: Divide and Conquer (logarithmic)

  12. Approach 4 • Method: Closed form solution Golden Ratio

  13. Conclusion • Difference Design  Difference Performance • This class emphasizes on designing “efficient algorithm”

  14. Algorithm Again • It is the essence of the computation

  15. Side Note on Algorithm • Named after a Persian mathematician “AbūʿAbdallāhMuḥammadibnMūsā al-Khwārizmī” • Wrote book on linear equation • Introduce number 0

  16. TOPICS Overview Analysis part

  17. Asymptotic Notation • Measurement of “efficiency” of algorithms • How to compare two algorithms • How to predict behavior of the algorithm

  18. Big O analysis • How to determine Big O of some code • Recurrent Relation

  19. NP-Complete • What computer could solve • Efficiently • Inefficiently • The difference between “Efficiency” and “Inefficiency”

  20. Topics Overview Synthesis part

  21. Divide and Conquer • Solve an instance of the problem by dividing it into smaller instances • Based on induction • Example Problems: • Sorting (Quick Sort & Merge Sort) • Maximum Contiguous Sum of Subsequence • Modulo Exponential • Closest Pair

  22. Dynamic Programming • Aim to reduce redundancy in computation • For the case when there are several overlapping sub-problems • Example Problems: • Fibonacci Number • Binomial Coefficient • Matrix Chain Multiplication • Longest Common Subsequence • Largest Square in Binary Picture (Island problem)

  23. Greedy Algorithm • Solve the problem by doing the best for the current step • Proof of correctness • Example Problems: • Minimum Spanning Tree • Prim’s Algorithm • Kruskal’s Algorithm

  24. Graph Algorithm • Algorithm related to graph structure • Breadth First Search • Depth First Search • Shortest Path

  25. Search • Solve the problem by enumeration • Systematical enumeration • Performance improvement • Branch and Bound • Backtracking

More Related