Search Algorithms Flashcards

1
Q

What are the steps of a Breadth-First Search (BFS)?
(4 points)

A
  1. Pick a vertex.
  2. Explore that vertex, ‘visiting’ all adjacent vertices.
  3. Pick an unexplored vertex from among the adjacent vertices.
  4. Repeat steps 2 and 3 until the graph is explored.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the steps of a Depth-First Search (DFS)?
(4 points)

A
  1. Pick a vertex.
  2. Visit one of that vertex’s adjacencies.
  3. Repeat step 2 until we can’t find any.
  4. Once we can’t find any, backtrack and repeat step 2-3.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the steps of a Uniform Cost Search (UFS)?

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

What does it mean for a search algorithm to be ‘uninformed’ or ‘blind’?

A

Does not have any additional information about the search space besides its structure.

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

What does it mean for a search algorithm to be complete?

A

If it provides a solution for a given input if there does exist at least one solution. In other words, if a solution exists, it will always find it.

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

What does it mean for a search algorithm to be optimal?

A

The best solution given at the lowest path cost.

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

What is meant by time complexity?

A

Time complexity is the variable quantity of time used when running an algorithm.

For example, an algorithm with time complexity O(x) will take as much time as x exists. In most cases, this is the number of data points.

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

What is meant by space complexity?

A

Space complexity is the variable quantity of space or memory used when running an algorithm.

For example, if a algorithm uses a queue to store only data points, it would have a space complexity of O(x), where x is the number of data points given as input.

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

What is the time complexity of a BFS/DFS?

A

O(V + E), where V is the number of vertices and E is the number of edges.

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

What is the space complexity of a BFS/DFS?

A

O(V), where V is the number of vertices.

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

What is the difference between a Greedy Search and a Uniform Cost Search?

A

A Greedy Search goes straight for the closest, smallest cost, while UFS takes its time and finds the most optimal solution.

Greedy Search is not optimal or complete, but it is faster.

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

What are the two search algorithms that are both optimal and complete?

A

Breadth-First Search and Uniform Cost Search.

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

What are the two search algorithms that are neither optimal nor complete?

A

Depth-First Search and Greedy Search.

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

What is the difference between BFS and DFS?

A

A BFS carefully searches all of its adjacent vertices, while DFS ‘rushes to the end’ and only goes back once it has reached an endpoint.

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

Which is a type of informed search: Greedy or Uniform Cost?

A

Greedy Search.

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

What is the defining attribute of A* Tree Search?

A

A* uses its informed nature to consider both a current cost, and an estimated heuristic of how far that point is from the goal.