Asymptotic Complexity
misc.
Greedy Graph Algorithms
NP Completness
Minimum Spanning Tree
100

Give the Asymptotic complexity of the following:

f(n) = 6n^3

theta(n^3)

100

True or False: In hashing, a collision occurs when two distinct keys are mapped to the same hash value.

True: A collision occurs when two distinct keys are mapped to the same hash value in hashing.

100

Define a graph and its components (vertices and edges):

A graph G is a mathematical structure consisting of a set of vertices (nodes) V and a set of edges E, where each edge connects two vertices. The edges may be directed or undirected, and they may have weights assigned to them.

100

What is P

Polynomial time are those that can be solved by algorithms whose worst-case running time is polynomial in the size of the inputs.

      - Easily Solvable


100

True or False: The weight of a minimum spanning tree is always less than or equal to the weight of any other spanning tree in the same graph.

True

200

Give the Asymptotic Complexity of the following:
f(n) = (6n^3 + 20n^4 +8)^2

theta(n^8)

200

For this recurrence relation problem would you use a recursion tree or substitution:

T(n) = cn^2 + T(n/3) + T(n/sqrt2)

What is a recursive tree?

200

Define the shortest path problem and its variants:

  • The shortest path problem is to find the shortest path between two vertices in a weighted graph, where the path length is defined as the sum of the weights of its constituent edges. Variants include:
    • Single-source shortest path: Finding the shortest path from a single source vertex to all other vertices in the graph.
    • All-pairs shortest paths: Finding the shortest paths between all pairs of vertices in the graph.
200

What is NP

Nondeterministic polynomial time are those for which a given solution can be verified quickly(if a solution is correct), but finding the solution is harder.

        - Easily Checkable

200

True or False: Every connected graph has a unique minimum spanning tree.

False: While every connected graph has at least one minimum spanning tree, it may have multiple minimum spanning trees if there are edges with the same weight.

300

Give the Asymptotic Complexity of the following:
f(n) = 6 * 4^n + 8 * 2^n+8 +10

theta(4^n)

300

True or False: Hashing guarantees constant-time insertion, deletion, and search operations.

False: While hashing provides average constant-time insertion, deletion, and search operations, in the worst case, these operations can take O(n) time due to collisions.

300

Discuss algorithms for finding shortest paths, such as Dijkstra's algorithm:

Dijkstra's algorithm: Finds the shortest path from a single source vertex to all other vertices in a non-negative weighted graph. It maintains a priority queue of vertices based on their tentative distances from the source.

300

True or False: The Traveling Salesman Problem (TSP) is an example of an NP-complete problem.

True: The Traveling Salesman Problem (TSP) is indeed an example of an NP-complete problem.

300

True or False: Prim's algorithm can be implemented using either a priority queue or an array-based approach to select the next edge to add to the spanning tree.

True: Prim's algorithm can be implemented using either a priority queue or an array-based approach to select the next edge to add to the spanning tree.

400

Rank these from highest complexity to lowest:
theta(n^2)

theta(n^n)

theta(n^0.3)

theta(nlog(n))

theta(n!)

theta(n)


theta(n^n)

theta(n!)

theta(n^2)

theta(nlog(n))

theta(n)

theta(n^0.3)


400

True or False: In a max-heap, the value of each node is greater than or equal to the values of its children.

True: In a max-heap, the value of each node is greater than or equal to the values of its children.

400

True or False: Dijkstra's algorithm can be used to find the shortest path in a graph with negative edge weights.

False: Dijkstra's algorithm cannot handle negative edge weights. It assumes all edge weights are non-negative.

400

What is the difference between a problem being in NP and being NP-complete?

Difference between NP and NP-complete: NP refers to the class of decision problems for which a solution can be verified in polynomial time. NP-complete refers to a subset of NP problems to which all other problems in NP can be polynomially reduced.

400

True or False: If all edge weights in a graph are distinct, then the minimum spanning tree of that graph is unique.

True: If all edge weights in a graph are distinct, then the minimum spanning tree of that graph is unique.

500

Give the asymptotic complexity of the following:

f(n) = 2 log₂((2n^2 +8) log₂(8n^2 +10)

theta (log(n))

500

True or False: Heapsort is an in-place sorting algorithm that has a worst-case time complexity of O(nlogn).

True: Heapsort is an in-place sorting algorithm with a worst-case time complexity of O(nlogn), making it efficient for sorting large datasets.

500

True or False: Dijkstra's algorithm guarantees finding the shortest path from the source vertex to all other vertices in the graph.

True: Dijkstra's algorithm guarantees finding the shortest path from the source vertex to all other vertices in the graph, provided the graph has non-negative edge weights.

500

Define the concept of polynomial-time reduction and explain how it is used to show NP-completeness.

Definition of polynomial-time reduction: Polynomial-time reduction is a technique used to show that one problem is at least as hard as another. If problem A can be reduced to problem B in polynomial time, and B is NP-complete, then A is also NP-complete.

500

True or False: For any weighted connected graph, if we remove the maximum-weight edge from any cycle in the graph, the resulting graph must have the same minimum spanning tree as the original graph.

True:Removing the maximum-weight edge from any cycle in a weighted connected graph preserves the graph's connectivity while ensuring that the minimum spanning tree remains unchanged, as the removed edge cannot be part of any minimum spanning tree.

M
e
n
u