Foundations of Algorithm Analysis Flashcards

1
Q

Run Time

A

The running time of an algorithm varies with the input and typically grows with the input size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

following run times

A

❑Best case
❑Worst case
❑Average case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The average case

A

*difficult to determine
❑Take all inputs and calculate time for all inputs
❑Sum all calculated values and divide by total input

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The best case

A
  • not very informative
    ❑Might not happen very often
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

worst case

A

❑Easier to analyse
❑Crucial to applications such as air traffic control, surgery, finance,…
❑E.g. Real time applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Limitations of Experimental Studies

A

❑It is sometimes difficult to implement the algorithm
❑Results may only be indicative of the running time for some inputs, but not for all possible inputs
❑One algorithm can perform better than the rest for some inputs. For other inputs,
another algorithm could be better
❑In order to compare two algorithms, the same hardware and software environments must be used
❑However, we will still measure the run time of some of our experiments for practice purposes…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Asymptotic Analysis

A

❑The technique uses a high-level description of the algorithm instead of an implementation
❑We evaluate the performance of an algorithm in terms of input size. ❑We calculate how the time taken by an algorithm increases with the input size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Estimating “Running Time”

A

❑Write down an algorithm
❑Using Pseudo-Code
❑In terms of a set of primitive operations
❑Count the number of steps
❑Consider worst-case input
❑Bound or “estimate” the running time
❑This leads to the Big-Oh (Big-O) notation for computational complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is T(n)

A

❑To measure the running time/computation of an algorithm
❑We refer to this resultant formulae as T(n)where nis the size of the input
❑If there is more than one input we might have T(n,m)(etc…) where nand mare the sizes of the inputs
❑We can use T(n)to compute the Big-O notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Pseudo-Code

A

❑Not an actual programming language…
❑Pseudo-Code is a cross between a programming language and written text
❑It is used to represent algorithms in a programming language-independent manner
❑We often specify the input and output and number the lines
❑The Pseudo-Code I will now describe is an adaptation of a standard…
❑Once you can read one type of Pseudo-Code it is easy to follow any variations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Primitive Operations

A

❑Basic computations performed by an algorithm
❑Identifiable in Pseudo-Code
❑Examples:
❑Evaluating an expression (x>y?)
❑Assigning a value to a variable (x=0)
❑Indexing into an array (for A[0]or A[i]we might use the mathematical notation a0or ai)
❑Calling a method
❑Returning from a method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly