**CS/ACC/PE 360** - Analysis of Algorithms, "Beancounting for Techies"

Accounting - Down to the penny - with "misc"

Algorithms - Asymptotic bounds - O(n)

**Algorithm** - "a well defined computational procedure that takes ... input and produces ... output."

WHAT DATA STRUCTURES TO USE!(lists, queues, stacks, heaps, trees, etc.)IS IT CORRECT!(all or only most of the time?)HOW EFFICIENT IS IT!(asymptotically fixed or does it depend on the inputs?)IS THERE AN EFFICIENT ALGORITHM!!- P ≟ NP

Many practical problems can be cast as mathematical ones, i.e. graphs, linear programming, string matching, etc.

Algorithmic analysis is primarily about *proving* that a procedure is correct and then *counting* the number of operations required for the procedure to execute, i.e. finding the *run-time*. In this class we will use mathematical "proofs" to find *asymptotic bounds* ignoring numerous factors that get lumped into "hidden constants", but in real situations other overhead would ultimately want to be considered such as:

- runtime overhead - such as memory management, function calls, etc.
- additional auxilarly storage requirements
- hardware functionality - such as parallel architectures

We will be using pseudocode for our algorithm implementations and will follow the conventions described in Chapter 2 of the textbook (CLRS) with the important ones summarized here.

Indentationwill indicate block structures (similar to Python)Loops(for,while) anddecisions(if/else) follow standard C++/Java conventions, i.e. the loop counter retains its value that caused the loop to terminate (useful when proving the correctness of an algorithm)//indicatescomments=indicatesassignment(and can be used for multiple assignment)- Variables are
localto the procedure in which they are used- Array elements are accessed with
bracketed indicesas in C++/Java, e.g. A[i]- The notation ".." is used to indicate a (inclusive)
subarray, e.g. A[i..j] indicates the elements <A[i],A[i+1], ..., A[j]>- Object
attributesandmethodsare accessed using the standard "." notation, e.g. A.length- Object names are treated as
pointers, thus B = A creates analiasNOTa copy- Variables are passed
by value, except for objects and arrays which are passedby reference.Multiple valuesmay be returned in areturnstatement- Boolean expressions are
short circuiting, i.e. are evaluated left to right only until the value of the expression is known