Algorithms Flashcards

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

How does a queue work?

A

Data can only be added to the end and Data can only be retrieved from the front.

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

How does a stack work?

A

If you want to remove an item, you have to remove the item that was added most recently.

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

How does a hash table work?

A

The data being stored is passed into a hashing algorithm that generates an address, the data is then stored at that address in the hash table.

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

What is a graph?

A

A graph is a set of nodes connected by edges. An edge can have a weight to show the cost to traverse it and a direction in which it must be traversed.

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

What is a depth first traversal of a graph?

A

You go as far down one route as you can before backtracking until you can take a new route.

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

What is a breadth first traversal of a graph?

A

We visit all the neighbours of the root node, and then all the neighbours of the first node visited, and then all the neighbours of the second node and so on.

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

What is the difference between Dijkstra’s algorithm and A* algorithm?

A

A* uses the sum of heuristic distance to the finish and the distance travelled to decide the next node to visit, Dijkstra only uses the distance travelled.

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