2.3.1 Algorithms - Aaron Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is binary search?

A

A O (log(n)) algorithm to search a sorted list for a particular item by repeatedly halving a sublist which could contain the item.

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

What is the big O for constant complexity?

A

O (1)

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

How is time complexity measured?

A

Big O notation

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

What does exponential time complexity mean?

A

The amount of time to complete an algorithm is proportional to 2 to the power of number of items inputted.

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

What does logarithmic time complexity mean?

A

The time taken to complete an algorithm will increase at a smaller rate as the number of elements inputted.

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

What is an algorithm?

A

An algorithm is a series of steps that complete a task.

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

What is the big O of a linear search algorithm?

A

O (n)

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

What is the big O of a binary search algorithm?

A

O(log(n))

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

What is the big O of a bubble sort algorithm?

A

O (n2)

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

What is a logarithm?

A

How many times a certain number is multiplied together to reach another number.

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

What 2 pieces of information allow you to analyse an algorithm?

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

What is meant by the time complexity of an
algorithm?

A

The amount of time required to solve a
particular problem.

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

What does a linear time
complexity mean?

A

The amount of time taken to complete an
algorithm is independent from the
number of elements inputted.

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

What does a constant time
complexity mean?

A

The amount of time taken to complete an
algorithm is independent to the number
of inputted elements.

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

What is space complexity?

A

The space complexity is the amount of
storage space an algorithm takes up.

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

How do you reduce the space
complexity?

A

Try to complete all of the operations on
the same data set

17
Q

How do you reduce the time complexity
of an algorithm?

A

You reduce the amount of embedded for
loops, and then reduce the amount of
items you complete the operations on i.e.
divide and conquer

18
Q

What does time complexity scale within an algorithm?

A

The number of individual steps taken.

19
Q

How do we write big O notation?

A

O(n^x) where x is the highest power of n the algorithm reaches.

20
Q

What is the Big-O notation good for?

A

It allows you to predict the amount of
time taken to solve an algorithm given
the number of items stored.