Algorithms and Programming Flashcards

1
Q

Define Recursive Algorithm

A

An algorithm that recalls itself during its run time

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

Describe the recursion method

A

It is a method of solving a problem where the solution depends on solving increasingly smaller instances of the same problem

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

How is a stack overflow caused

A

When a recursive algorithm has no base case to stop itself.

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

What is the Base Case

A

It sets the very end of where the algorithm can run to, as it will then force it to end

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

What is the general case

A

A section of the program that decreases in size each time the algorithm is called

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

What does Big O notation find

A

The complexity of an algorithm

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

How are algorithms compared

A

In terms of their complexity

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

What are the two versions of an algorithm Big O notation looks at

A

The longest version
The shortest version, Which is called the constant complexity

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

What does O(1) represent

A

The constant complexity, the shorts time any algorithm can take

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

What is the best outcome of an algorithm

A

Constant complexity

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

what does O(n) represent

A

A linear time where the time taken is directly proportional to the size of n

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

What does O(n^2) represent

A

The polynomial complexity, since the greater the amount of data the greater the time complexity

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

what does O(2^n) represent

A

The exponential complexity, since the result is doubled each time n increases by 1

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

Which is worse O(n^2) or O(2^n)

A

O(2^n)

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

What version of the Big O notation do we use to estimate the run time in a worst case scenario

A

The largest version, since the smaller parts can be seen as inconsequential to the larger parts

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

Define Best case

A

The algorithm only have to run once

17
Q

Define Worst case

A

the algoroithm needs to run the greatest possible number of times

18
Q

Define Average case

A

The algorithm has to run for a reasonable length of time

19
Q

How do we compare two different algorithms

A

We compare their graphs and see at an amount of data which will take longer to complete

20
Q
A