Algorithms Flashcards

1
Q

What is the stop condition for a shell sort?

A

After final shuttle pass where INT(n/2)= 1

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

Travelling salesman- What is a tour?

A

Visits vertices once, returns back to the beginning.

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

What is a Eulerian cycle?

A

A route that travels along every edge exactly once before returning to the beginning.

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

For a complete graph of n vertices (Kn), what is the condition for the graph to be Eulerian.?

A

n must be odd

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

Under what conditions are the maximum number of swaps and comparisons required to sort a list of numbers using a Bubble or Shuttle sort?

A

Reverse ordered list

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

What is a connected graph?

A

A path exists between every pair of vertices.

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

Given a choice of upper bounds, how do you select which one is best?

A

The lowest one.

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

For a connected graph of n vertices (Kn), how many edges are there in a Hamiltonian cycle?

A

n

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

For a complete graph of n vertices (Kn), what is the order of a vertex?

A

n - 1

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

What is the STOP condition for a Shuttle sort?

A

When the end of the list is reached (n - 1 passes)

Shuttle back until no swaps occur or the start of the list is reached.

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

When finding a Chinese Postman route through a network, how do you find out how many times you pass through a vertex?

A

Add repeated edges to graph then half order (representing in and out) for that vertex.

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

Travelling salesman- How do you express the interval within which an optimal tour T lies?

A

Lower Bound

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

For a complete graph of n vertices (Kn), how many Hamiltonian cycles are there (assuming tours in reverse order are of the same length?

A

(n - 1) ! / 2

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

Which algorithms are greedy?

A

Prim: always lead to the best solution

Kruskal: always lead to best solution

Nearest Neighbour: does NOT necessarily lead to the best solution and it may not be possible to apply it.

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

After applying Dijkstra to find the shortest path through a network from start vertex to end vertex, how do you find the shortest path to the other vertices?

A

Permanent labels at each vertex give length of the shortest path from start vertex.

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