This preview shows page 1. Sign up to view the full content.
Unformatted text preview: misleading
NCKU IIM
NCKU 資料結構 Chapter 2
資料結構 12 Worstcase and Averagecase Analysis
• Averagecase: require probability analysis
• Usually, we concentrate on finding only on the
Usually,
worstcase running time
worst
• Reason:
Reason:
–
–
– It is an upper bound on the running time
The worst case occurs fair often
The average case is often as bad as the worst case.
The
For example, the insertion sort with tj=j/2. Again,
=j/2.
quadratic function although with smaller coefficient.
smaller NCKU IIM
NCKU 資料結構 Chapter 2
資料結構 13 Order of Growth
• In some particular cases, we shall be interested in
In
averagecase, or expected running time of an
average
or expected running
algorithm. (Chap 5)
algorithm.
• It is the rate of growth, or order of growth, of
It
rate
or order
of
the running time that really interests us.
–
–
–
– Only look at the leading terms (drop lowerorder terms)
Ignore the constant coefficient in the leading term
2
E.g. insertion sort: Θ(n )
More on this topic will be taught in Chap 3
NCKU IIM
NCKU 資料結構 Chapter 2
資料結構 14 2.3 Designing Algorithms
2.3
There are many ways to design algorithms:
There
• Incremental approach: insertion sort
• Divideandconque...
View
Full
Document
This note was uploaded on 02/08/2013 for the course SCI 399 taught by Professor Bob during the Winter '12 term at Bismarck State College.
 Winter '12
 bob

Click to edit the document details