2.3.1 Analysis, Design and Comparison of algorithms Flashcards

1
Q

What are the two things to check when developing an algorithm?

A
  • Time complexity
  • Space complexity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is time complexity?

A
  • How much time is taken to solve a problem
  • Big-O notation shows the effectiveness of the program
  • Can be reduced by eliminating embedded loops when possible
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does O(1) represent?

A
  • Constant time complexity
  • Time taken is independent drom number of elements inputed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does O(n) represent?

A
  • Linear time complexity
  • Time taken is directly proportional to number of elements inputed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does O(n^n) represent?

A
  • Polynomial time complexity
  • Time taken is directly proportional to the elements inputed to the power of n
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does O(2^n) represent?

A
  • Exponential time complexity
  • Time taken will double with every additional item
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does O(log n) represent?

A
  • Logarithmic time complexity
  • Time taken will increase at a smaller rate as the number of elements inputted increases
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is space complexity?

A
  • Amount of storage the algorithm takes
  • Can be reduced by avoiding making copies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly