analysis algorithm

Upload: balafreebirds

Post on 06-Apr-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Analysis Algorithm

    1/17

    Analysis of Algorithms

    INTRODUCTION

    Analysis of Algorithms

  • 8/3/2019 Analysis Algorithm

    2/17

    Algorithm

    Definition 1: A finite set of precise instructions for

    performing a computation or for solving a problem.

    Definition 2: A specific set of instructions for carrying out a

    procedure or solving a problem, usually with the requirement

    that the procedure terminate at some point.Definition 3: A procedure for solving a mathematical

    problem in a finite number of steps that frequently involves

    repetition of an operation.

    Definition 4: A step-by-step procedure for solving a problem

    or accomplishing some end especially by a computer.

    Analysis of Algorithms 1

  • 8/3/2019 Analysis Algorithm

    3/17

    Algorithm

    Synonym: Method, Procedure, Program, Recipe, Routine

    Solution, Technique ...

    Etymology: Alteration of Middle English algorisme, from

    Old French & Medieval Latin; from Medieval Latinalgorismus, from Arabic al-khuwarizmi, from the name of

    the Persian Mathematician Al-Khowarizmi who was the first

    to formalize the rules for the 4 basic arithmetic operations.

    Analysis of Algorithms 2

  • 8/3/2019 Analysis Algorithm

    4/17

    8 Questions

    1. Who asks questions? Who produces problems?

    2. What is a problem and/or a solution? (model and language)

    3. Does a solution solve a problem? (correctness)

    4. What is the efficiency of a solution? (complexity)

    5. Is a solution scalable? (scalability)

    6. When is a solution good? Better? Best? (upper bounds)

    7. What are the limits of any solution? (lower bounds)

    8. Is a problem hard? How do we handle hard problems?

    Analysis of Algorithms 3

  • 8/3/2019 Analysis Algorithm

    5/17

    The Ultimate Question

    Question: How do we solve problems?

    Genius?

    Intuition?

    Luck?

    Experience?

    Hard work?

    Answer: a combination of these 5 factors!!!

    Analysis of Algorithms 4

  • 8/3/2019 Analysis Algorithm

    6/17

    How to solve a problem? Some Heuristics

    Search for a pattern. Draw a figure.

    Formulate an equivalent problem. Modify the problem. Choose effective notation. Exploit symmetry. Divide into cases. Work backward. Argue by contradiction.

    Pursue parity. Consider extreme cases. Generalize.

    Analysis of Algorithms 5

  • 8/3/2019 Analysis Algorithm

    7/17

    Algorithms Properties

    Correctness: for all valid inputs.

    Complexity Efficiency: as a function of the input size.

    Worst-case vs. average case.

    Limitations: for the algorithm and for the problem.

    Scalability: similar efficiency for any input size.

    Optimality: optimal or near-optimal or approximately

    optimal solution.

    Analysis of Algorithms 6

  • 8/3/2019 Analysis Algorithm

    8/17

    Teacher Amotz Bar-Noy

    E-mail: [email protected].

    Internet: http://www.sci.brooklyn.cuny.edu/amotz/714.

    Office Hours: Tuesday 3:00pm4:00pm, Room 2112a.

    Class Hours: Tuesday 6:00pm8:05pm,

    Extra Hours: Tuesday 5:15pm6:00pm and 8:05pm9:00pm.

    Class Room: 236NE.

    Analysis of Algorithms 7

  • 8/3/2019 Analysis Algorithm

    9/17

    Textbooks

    Textbook: Introduction to Algorithms (second edition),

    by Cormen, Leiserson, Rivest, and Stein.

    Another book: Algorithm Design, by Goodrich and

    Tamassia, Wiley.

    Another book: Introduction to Algorithms a Creative

    Approach, by Manber, Addison-Wesley.

    Analysis of Algorithms 8

  • 8/3/2019 Analysis Algorithm

    10/17

    Tentative Syllabus:

    Introduction, Mathematical Background, Examples, Divide

    and Conquer,

    Searching, Sorting, and Sorting Networks,

    Greedy Algorithms and Huffman Codes,

    Dynamic Programming,

    Graphs, Graph Traversals, Minimum spanning Trees,

    NP-Completeness.

    Analysis of Algorithms 9

  • 8/3/2019 Analysis Algorithm

    11/17

    Tentative Schedule

    01. 02/01/2004 Introduction02. 02/08/2004 Mathematical Background03. 02/15/2004 Examples and Divide and Conquer

    04. 02/22/2004 Searching and Order Statistics05. 03/01/2004 Sorting06. 03/08/2004 Sorting Networks07. 03/15/2004 ???

    08. 03/22/2004 Greedy Algorithms09. 04/05/2004 Midterm Exam10. 04/12/2004 Dynamic Programming11. 04/19/2004 Graphs

    12. 05/03/2004 Graph Traversals13. 05/10/2004 Minimum Spanning Trees14. 05/17/2004 NP-Completeness15. 05/24/2004 Final Exam

    Analysis of Algorithms 10

  • 8/3/2019 Analysis Algorithm

    12/17

    Tentative Schedule Remarks

    1. There are no classes on 03/29/2004 and on 04/26/2004.

    2. Some of the classes will start at 05:15pm instead of 06:00am

    and some will end at 09:00pm instead of 08:05pm. These

    extra hour(s) are reserved for solving the assignments.

    3. Dates with ??? are reserved either for completing the

    previous subjects or for additional subjects.

    Analysis of Algorithms 11

  • 8/3/2019 Analysis Algorithm

    13/17

    Grading

    Note: This is only a guide, percentages and rules may change

    during the semester as needed.

    Percentages: The final grade will be composed of the

    following4

    components: 50% 60% final exam.

    20% 30% mid-term exam.

    10% 15% quizzes.

    10% assignments.

    Analysis of Algorithms 12

  • 8/3/2019 Analysis Algorithm

    14/17

    Quizzes

    There could be 2 types of quizzes:

    At the beginning of the class to check what you learned

    in the previous week.

    At the end of the class to check what you learned during

    the 2 hours class.

    There will be no announcements regrading quizzes.

    The number of quizzes has not yet been determined.

    Analysis of Algorithms 13

  • 8/3/2019 Analysis Algorithm

    15/17

    Animation Project

    You may volunteer to animate one of the algorithms that

    will be taught in class.

    You must coordinate your choice with the teacher.

    You will be given at most 4 weeks to finish the animation

    project. In any case, no later than one week before the

    final exam date (12/16/2004).

    The percentage allocated to a project depends on its size.

    Analysis of Algorithms 14

  • 8/3/2019 Analysis Algorithm

    16/17

    Answering a question

    Answer a question in an exam, in a quiz, or in an assignment:

    Only within the given space for the answer.

    Using a readable text with normal size font.

    You get 20% of the value if you leave the answer blank.

    You get no points for a wrong answer.

    Analysis of Algorithms 15

  • 8/3/2019 Analysis Algorithm

    17/17

    Preparing Assignments

    Alone if you can.

    Get help if necessary.

    You must understand everything you write.

    Analysis of Algorithms 16