3. Fundamentals of Algorithms Flashcards

1
Q

What is the order of values for each iteration of a Bubble Sort Algorithm applied to [7, 3, 9, 5, 4, 2]?

A

[7, 3, 9, 5, 4, 2]
[3, 7, 5, 4, 2, 9]
[3, 5, 4, 2, 7, 9]
[3, 4, 2, 5, 7, 9]
[3, 2, 4, 5, 7, 9]
[2, 3, 4, 5, 7, 9]

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

What is the order of values which are visited when searching for the target value 5 in the Array [1, 2, 5, 7, 11, 15, 18] using the Binary Search Algorithm?

A

7, 2, 5

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

How is Depth First Search implemented differently from Breadth First Search?

A

Depth First Search uses a Stack
Breadth First Search uses a Queue

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

What is the purpose of Dijkstra’s Algorithm?

A

Dijkstra’s Algorithm calculates the shortest path and the distance between two nodes in a Graph.

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

Describe an Exhaustive Search approach to Problem Solving.

A

Exhaustive Search is when every possibility is checked only finishing when the correct answer is found or it is determined that no answer exists. An example of Exhaustive Search is a Linear Search applied to an Array.

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

Describe a Divide and Conquer approach to Problem Solving.

A

Divide and Conquer breaks a problem into smaller sub-problems which may be simpler to solve individually. An example of Divide and Conquer would be the Binary Search or Merge Sort Algorithms.

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

What does a Regular Expression allow you to do?

A

A Regular Expression is a string pattern which can be used to match other strings. For example we could create a Regular Expression to tell us whether a string contained an email address or a numberplate.

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