Introduction to Algorithm - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Introduction to Algorithm

Description:

????????????????????????????????????? ... Definiteness. rigorously and unambiguously specified. Input. valid inputs are clearly specified ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 13
Provided by: akarap
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Algorithm


1
Introduction to Algorithm
  • 463503
  • Design and Analysis of Computer Algorithms
  • ????? ????????
  • ?????????????????????????????????????
  • ??????????????????????
  • ?????????????????????????????????????
  • ????????????? A. Levitin, Introduction to The
    Design and Analysis of Algorithms

2
Why study algorithms?
  • Theoretical importance
  • the core of computer science
  • Practical importance
  • A practitioners toolkit of known algorithms
  • Framework for designing and analyzing algorithms
    for new problems
  • (Harel, 92) Algorithmics is the core of computer
    science, and in all fairness, can be said to be
    relevant to most of science, business, and
    technology.

3
Algorithm
  • A sequence of unambiguous instructions for
    solving a problem, i.e., for obtaining a required
    output for any legitimate input in a finite
    amount of time
  • Recipe, process, method, technique, procedure,
    routine, with following requirements
  • Finiteness
  • terminates after a finite number of steps
  • Definiteness
  • rigorously and unambiguously specified
  • Input
  • valid inputs are clearly specified
  • Output
  • can be proved to produce the correct output given
    a valid input
  • Effectiveness
  • steps are sufficiently simple and basic

4
Example greatest common divisor
  • Middle-school procedure
  • ??????????????????????????????? m
  • ??????????????????????????????? n
  • ?????????????????????? m ??? n
  • ???????????????????????? ?.?.?. ??? m ??? n
  • ???????? ?.?.?. ??? 60 ??? 24
  • 60 2.2.3.5
  • 24 2.2.2.3
  • gcd(60,24) 2.2.3 12

5
GCD(m,n) (cont)
  • Consecutive checking
  • ???????? t ??????? min(m, n)
  • ?????? m ???? t ????? (?????????? 0) ???????? 3
  • ?????? n ???? t ????? ??????????????????? t
    ????????? ???????????????? 4
  • ????? t ???? 1 ??????????????? 2

6
GCD(m,n) (cont)
  • Euclids algorithm
  • gcd(m,n) gcd(n, m mod n), gcd(m, 0) m
  • ??? n0 ?????????????????? m ?????????
    ???????????????? 2
  • ??? m ???? n ????????????????? r
  • ???????? m ?????????? n ??? n ?????????? r
    ??????????????? 1
  • E.g. gcd(60, 24) gcd(24, 12) gcd(12, 0) 12

7
Fundamental Data Structures
  • Linear data structures
  • Array and linked list
  • Graphs
  • Trees
  • Sets and Dictionaries

8
Basic Issues Related to Algorithms
  • How to design algorithms
  • How to express algorithms
  • Proving correctness
  • Efficiency
  • Theoretical analysis
  • Empirical analysis
  • Optimality

9
Algorithm design and analysis process
Understand the problem
Decide on computational means, exact vs.
approximate solving, data structures, algorithm
design strategies
Design an algorithm
Prove correctness
Analyze the algorithm
Code the algorithm
10
Algorithm Design Strategies
  • Brute force
  • Divide and conquer
  • Decrease and conquer
  • Transform and conquer
  • Greedy approach
  • Dynamic programming
  • Backtracking and Branch and bound
  • Space and time tradeoffs

11
Analysis of Algorithms
  • How good is the algorithm?
  • Correctness
  • Time efficiency
  • Space efficiency
  • Does there exist a better algorithm?
  • Lower bounds
  • Optimality

12
Some Well-Known Computational Problems
  • Sorting
  • Searching
  • String processing
  • Graph problems
  • Shortest paths in a graph
  • Minimum spanning tree
  • Primality testing
  • Traveling salesman problem
  • Geometric problems
  • Convex-hull problem
  • Closest-pair problem
  • Combinatorial problems
  • Knapsack problem
  • Chess
  • Towers of Hanoi
  • Program termination
Write a Comment
User Comments (0)
About PowerShow.com