Usually there is more than one way to solve a problem.
This means there is more than one solution... How do we decide which is better?
Compare
Space Complexity: amount of memory a program needs to run to completion (in book see pages 68-75; I will focus on time - in fact, skip to Section 2.3.4)
Time Complexity: amount of computer time a program needs to run to completion
instance characteristics:
A given program can be run on many different input sets.
A given run on a given program with a given set of data is an
instance.
When we measure time and space complexity of a program, we need to consider what happens as the number or size of data (for input or output) increases...i.e., what are the characteristics of the data for this instance which will affect the values for time and space?
Example: the length of a string affects the time it takes to search for a character in a string
Time analysis is based on the size of the data set.
To do time complexity, we do not want to simply measure the run of a program, but to determine mathematically how changes in data (for the given procedure) will change the time.
What happens as the size increases ?
ConsiderProgram Step - a meaningful segment of a program that has an execution time that is independent of the instance characteristics
Step counts - books vary...(note s/e below) (page 90-100)| Code | What it counts as | |
| comments | 0 | |
| declarative statements | 0 | |
| assignments | 1 (unless function calls) | |
| iterative statements | 0 or 1 (checking the <expr>) |
step counts are useful since they tell us how the run time changes with instance characteristics (e.g., for i = 1 to n ... if n doubles, time doubles)
(Note: Step counts do not necessarily reflect the complexity of the statement (in this book a function call is only one step). Steps/execution (s/e) is the amount count changes as a result of execution (see page 94 and sum(a,m))
The time complexity of a program is given by the number of steps taken by the program to compute the function it is written for. (i.e., s/e)

HELP with summation and induction review
[Do some T(n) ]
Use "Big O" to describe time (or space) complexity. "O" for order of the
algorithm.
Once an expression is obtained based on the data set, the order of the
algorithm is given by the dominating term.
For example:
Thus, it is easy to see that the coefficients or constants are insignificant.
(Later we will also get O(n) and verify.)
calculation of the above summations: (go backwards)
O(n3)
Try another
REVIEW on Summation equalities and playing around (same as link above)
Proof for the above.
Sometimes you don't know what a summation equals:
If T(n) = 2 + 3n, we say the algorithm is O(n) or of Order n
If T(n) = 0.5 * 2n + nlog2 n + 600,040 then the algorithm is O(2n)
First, Some Facts: put in cover of book (or somewhere easy to find)
Use proof by induction to show:

Proof by induction
Show base case
proof
Assume true for n
Prove true for n+1