Introduction to the algorithm of "lecture notes"

Source: Internet
Author: User

Course Address

Http://v.163.com/special/opencourse/algorithms.html

Today's course Address:

Http://open.163.com/movie/2010/12/G/F/M6UTT5U0I_M6V2T1JGF.html

Discussion performance

Analysis of algorithms:the Study of computer program performance ans resource usage.

Thinking:what is more important than performance?

Functionality, modularity, user-friendliness, security ...

Then why study ALGs and perf?

Performance is like the ' money ', you can buy other stuff ... This is a little bit of a deal.

Problem sorting

Insertion Sort

Every time I make sure I'm in the first place, it's sort.

8 2 4 9 3 6 i = 1

2 8 4 9 3 6 i = 2

2 4 8 9 3 6 i = 3

2 4 8 9 3 6 i = 4

2 3 4 8 9 6 i = 5

2 3 4 6 8 9 done

Running Time Analysis

    • Depends on input (best case, Wrost case)
    • Depends on input size

Wrost case, Ave case, best case

Analysis of BIG IDEA:ASYMPTOTC

    • Ignore Machine Dependent
    • Look at the growth

Θnotation, compared to n in the case of infinite big ~ so n^2 certainly faster than n^3.

Wrost Case:

Θ (n^2)

Merge sort a[1,..., N]

1, if n =1, done

2, recursively sort a[1,..., N/2] and A[N/2 + 1, ..., n]

3, merge 2 sorted lists

T (n) = 2T (N/2) +θ (n) if n > 1

T (n) = Cn*lgn +θ (n) =θ (NLGN) c stands for constant

Introduction to the algorithm of "lecture notes"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.