Lecture 2 Flashcards

1
Q

What do you compare algorithms using run time?

A

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

An algorithm may run faster on certain data sets than on others

Best case
Worst case
Average case

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

What are Experimental studies?

A

1) Running an algorithm with inputs of varying size and composition, multiple times
2) use method System.currentTimeMills() to get accurate measure of actual run time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
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

The same hardware and software environments must be used

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
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 does 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
5
Q

How do u estimate the running time/computation of an algorithm?

A

T(n) and O(n)

We refer to this resultant formulae as T(n) where n is the size of the input

If there is more than one input we might have T(n,m) (etc…) where n and m are the sizes of the inputs

We can use T(n) to compute a very important property called the Big-O O(n)

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

What are primitive operations?

A

Basic computations performed by an algorithm

Done by counting operations

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