Title: Introduction to Algorithms
1Introduction to Algorithms
Book by Thomas H. Cormen Charles E.
Leiserson Ronald L. Rivest and Clifford Stein
Powerpoint by Michael Block
2Chapter 1
3Algorithms
4Algorithms - Basic Definition
- A set procedure to process information.
- A correct algorithm is defined as
- Any algorithm that creates the desired
relationship between the input and output values.
5Algorithms - Examples - Sorting Algorithms
Insertion Sort
Merge Sort
Grouped
Original Input
Organize
Find the first incorrect placement
Sort the next incorrect placement
Final sorted input
Final sorted input
This step takes a lot longer than the others
Insertion sort is efficient when sorting small
amounts of numbers.
Merge sort is efficient with large amounts of
numbers.
6Data Structures
7Data Structures - Basic Definition
- Does not have to be organized.
- Usually created for a specific purpose or
situation.
- Use the data structure best suited for your
problem to allow your algorithm to be as
efficient as possible.
8NP-Complete Problems
9NP-Complete Problems - Basic Definition
- A problem without an efficient algorithm.
- If an efficient algorithm exists for one it
works for all.
10Efficiency
11Efficiency - Basic Definition
- Efficiency determines how well designed an
algorithm is.
- Efficiency does not have to be measured in time.
- Efficiency can be found by creating a formula of
each part in the algorithm based on a variable
and solving for that variable.
12And now for something completely different...
We will take a short break from algorithms and
chapter 2 to work on math concepts in chapter 3.
13Chapter 3
14All Greek to me -
- Pronounced theta
- Used in graphing curves and parabolas to create
an upper and lower bound.
Asymptotic upper bounds
Original function
Starting point for the asymptotic bind
Asymptotic lower bounds
15All Greek to me -
Because the base of both sides is (n) the
equation is asymptotically tight bound. The
coeficients of n do not matter as long as the
term stays basically the same.
Data being tested
Theta creates an upper and lower bounds so that
the data stays within an acceptable range.
16All Greek to me -
Asymptotically tight bound
Not asymptotically tight bound
Because n is on both sides of the equation.
Because one side contains n² and the other
contains n¹.
17All Greek to me - O
O - Pronounced big-oh
- Used in graphing curves and parabolas to create
an upper bound.
Asymptotic upper bounds
Starting point for the asymptotic bind
Original function
18All Greek to me - O