Stipek: Stop and Think Flashcards

1
Q

For a graph with all unique edge weights, both Kruskal’s and Prim’s Algorithm will always return the same exact MST. Why might this be the case?

A

If a graph have unique edge weights that means every path between any two nodes must be unique.????

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

Can a graph have more than one spanning tree that fulfills the four spanning tree properties mentioned above?

A

Yes.

If edge weighs are not all entirely unique multiple paths using edges of the same weights can generate the same minimum value with different edge sets

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

Which of the following are valid ways to modify an unweighted graph to have Dijkstra’s Algorithm be able to accurately produce the shortest paths from one vertex to all other vertices?

A

We can assign a cost of 1 to each edge.

We can assign a cost of ¹/₂ to each edge.

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

STOP and Think: It is important to note that there does not exist such a simple recursive pseudocode for Breadth First Search; why might this be the case?

A

????

Is it because of the vague base case?

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

STOP and Think: If our database string D has length n, what is the space complexity of storing all of its n suffixes?

A

You need to store n, then n-1, then n-2, then …… until 1

So its (n) + (n-1) + (n-2) + … (2) + (1) = n(n+1)/2 ~ n^2

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

STOP and Think: How can we reformulate our algorithm to find the correct first and last suffixes?

A

Instead of doing a single binary search to determine whether or not we have any matches, do two binary searches with slightly different “success” criteria:

Find the i-th suffix that begins with w such that the (i-1)-th suffix does not start with w. This is the start of the range of matches
Find the j-th suffix that begins with w such that the (j+1)-th suffix does not start with w. This is the end of the range of matches
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

STOP and Think: (end of Suffix array) Can we think of an even more clever preprocessing of our database sequence to enable even faster query searches?

A

Burrows Wheeler Transform

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

STOP and Think: Is there any way for us to reconstruct our original string using only the first and last columns of our Burrows-Wheeler Matrix?

A

For each letter __ m, the i-th occurence of x in the first column happens to correspond to the exact same lette in the original string as the i-th occurence in the last column.

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

STOP and Think: Given only the BWT, do we actually need the original string (or any information about the original string) to construct any parts of this table?

A

Not really

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

STOP and Think: How could you transform an undirected graph into a directed graph?

A

Yes, just give it a direction

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

STOP and Think: Can the Hash Table above ever get full (using seperate chaining?

A

depends on what is meant by “full”

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