1 / 18

Introduction to Algorithms

Book by Thomas H. Cormen Charles E.

Leiserson Ronald L. Rivest and Clifford Stein

Powerpoint by Michael Block

Chapter 1

Algorithms

Algorithms - 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.

Algorithms - 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.

Data Structures

Data Structures - Basic Definition

- A means of storing data.

- 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.

NP-Complete Problems

NP-Complete Problems - Basic Definition

- A problem without an efficient algorithm.

- If an efficient algorithm exists for one it

works for all.

Efficiency

Efficiency - 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.

And now for something completely different...

We will take a short break from algorithms and

chapter 2 to work on math concepts in chapter 3.

Chapter 3

All 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

All 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.

All 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¹.

All 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

All Greek to me - O