1 chapter 1-- introduction chapter 2-- algorithms and complexity 暨南大學資訊工程系...

27
1 Chapter 1 -- Introduction Chapter 2 -- Algorithms and Complexity 暨暨暨暨暨暨暨暨暨 暨暨暨 (Guan-Shieng Huang) 2005/02/21

Post on 21-Dec-2015

241 views

Category:

Documents


3 download

TRANSCRIPT

1

Chapter 1 -- IntroductionChapter 2 -- Algorithms and Complexity

暨南大學資訊工程系黃光璿 (Guan-Shieng Huang)2005/02/21

2

A Rock Game

Alice vs Bob 10+10 Bob can solve 2+2. How about 20+20? Or, 10+10+10?

The rule is: you can remove one rock from each pile or both of them.

The player who takes the last rock(s) wins the game.

3

4

Alice

Move first. Had learned Algorithm CSIE210022.

5

Answer

If you had learned Finite Automata…

6

What is an Algorithm?

Assignment a:=1 b:=a

7

Arithmetic a+b a-b (a+b)*c+a/d

8

Conditional if statement1 then

statement2 else

statement3

9

for loops for i=1 to 100 do statement

10

while loops while statement1 dostatement2

11

Array access a[100] a[a[i]]

12

Biological Algorithms vs Computer Algorithms

DNA helicase

topoisomerase

single-strandbinding protein

DNA

13

primase

DNA polymerase

5’ 3’

14

DNA ligase

15

16

Correct versus Incorrect Algorithms Soundness

所考慮到的情況都正確的處理 Completeness

考慮到所有可能的情況

17

Recursive Algorithms

Tower of Hanoi Problem

18

19

20

Iterative versus Recursive Algorithms

21

22

23

24

Fast versus Slow Algorithms

25

Big-O Notation

A function f(x) is O(g(x)) if there are positive real constants c and x0 such that f(x)≤g(x) for all values of x≧x0.

26

Algorithm Design Techniques

Exhaustive Search Branch-and-Bound Algorithms Dynamic Programming Divide-and-Conquer Algorithms Machine Learning Randomized Algorithms

27

Tractable versus Intractable Problems polynomial-time solvable problems nondeterministic polynomial-time solvable

problems beyond P P vs NP