Gregory M. Kapfhammer

flickr photo by by physician1977 shared under a CC Public Domain Dedication (CC0)

**Key Concept**

**Corresponding Diagram**

**In-Class Discussion**

**In-Class Activity**

**Details in the Textbook**

Systematic way of organizing and accessing data

A step-by-step for performing a task in a finite time

Comparable results only when using same environment

Limited set of inputs may lead to incorrect conclusions

You must fully implement and test the algorithms

Work independent of hardware and software

Takes into account all possible inputs

Does not require algorithm implementation

Assign a value to a variable

Follow an object reference

Compare two numbers

Return from a method

Call a method

**Any questions about these types of operations?**

Constant

Logarithm

Linear

n-log-n

Quadratic

Cubic

Exponential

log n: 3, 4, 5, 6, 7, 8, 9

n: 8, 16, 32, 64, 128, 256, 512

Quadratic: 64, 256, 1024, 4096, 16384, 65536, 262144

**Cubic and exponential grow much faster!**

**Any questions about these growth rates?**

Fast algorithm running on a slow computer

Slow algorithm running on a fast computer

Good algorithm design is very important

Ensure that your algorithm has a slow growth rate

Dramatic speedups in hardware cannot overcome asymptotically slow algorithms

**See Tables 4.4 and 4.5 for more details!**

This algorithm is O(n)!

Can you clearly explain why?

This algorithm is O(n^{2})!

Can you clearly explain why?

This algorithm is O(n^{2})!

Can you clearly explain why?

This algorithm is O(n×logn)!

Can you clearly explain why?