CSE 3500 Module Test #2

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Consider the greedy algorithm that solves the interval scheduling problem. Which one of the following is not part of the greedy stays ahead proof used to prove optimality?

Compare the greedy solution to an optimal solution

Which of the following best describes the cycle property?

Consider a cycle in the graph. The most expensive edge in the cycle cannot be in any minimum spanning tree.

Describe the cut property

Consider a partition of the nodes in a graph into two sets. The cheapest edge joining the sets must be in any MST.

Which one of the following best describes the cut property?

Consider a partition of the nodes in a graph into two sets. The cheapest edge joining the sets must be in any minimum spanning tree.

In Dijkstra's algorithm, nodes will be added iteratively to a tree of shortest paths. Which one of the following selection strategies best describes Dijkstra's algorithm?

Consider all nodes reachable from the tree that are not already in the tree. Choose the one that has the shortest distance from the start node

Which proof technique is commonly used to show that a greedy algorithm is not optimal?

Counterexample

Consider the problem of finding a minimum spanning tree of a weighted graph. Which one of the following algorithms does not find an optimal solution to the problem?

Dijkstra's algorithm

Consider an undirected graph G and a start node s, which one of the following statements is not true regarding a breadth-first search in the graph G from s?

Edges that are in G but not in the breadth-first search tree connect nodes in the same layer

Which one the following statements regarding bipartite graphs is not true? A bipartite graph cannot contain an odd cycle. Every bipartite graph is a tree. All trees are bipartite. A graph is bipartite if its nodes can be split into two sets with no edges between nodes in the same set.

Every bipartite graph is a tree.

Consider the proof of correctness of Dijkstra's algorithm. We call the graph G, the start node s, the set of explored nodes S and the set of active nodes A. What is the claim that we prove to be true in each step of the algorithm?

For any node v in S, the path from s to v given by the algorithm is the shortest s-v-path in G. No shorter path can be found outside of S.

Consider an undirected graph G with n nodes, which one of the following four statements implies the other three?

G is a tree

What strategy is used to determine connectivity in a graph

Graph search

Which proof technique is used to show that the greedy algorithm that solves the interval scheduling problem is optimal?

Greedy Stays Ahead

Which strategy is used to prove the correctness of Dijkstra's algorithm?

Greedy Stays Ahead

Which one of the following statements regarding a DAG is not true?

If a directed graph has at least one node with no incoming edges, the graph is a DAG.

Which one of the following statements regarding topological orderings is not true?

If a topological ordering exists, it is unique.

Which one of the following statements regarding strongly connected components in a directed graph is not true?

If two nodes u and v belong to different strongly connected components, there can be no path from u to v.

Consider a graph G with n nodes and m edges. What is the sum of the degrees of all the nodes in the graph equal to?

2m

Graph - Dijkstra's Algorithm

A C D E F G B

Consider an adjacency matrix A representing the undirected graph G with no self-edges (edges from a node to itself). Which one of the following statements is not true?

A is a n × m matrix.

In which heap operation is the procedure heapify up used?

Add a new element

Consider a graph G and the tree T produced in a depth-first search on G starting in a node s. Which one of the following statements is true regarding the tree T?

All edges in G connect nodes that are ancestors and descendants of each other in T

Which secondary data structure can be used?

An array with n elements

Consider the greedy algorithm that solves the minimize lateness problem. Which proof technique is used to prove optimality of the algorithm?

An exchange argument

Consider the proof of optimality of the greedy algorithm that solves the interval scheduling problem. In the last step of the proof, a proof by contradiction is used. Which assumption is made that leads to a contradiction?

Assume that the greedy solution is not optimal.

Algorithm to test bipartiteness in a graph

BFS

We have seen Dijkstra's algorithm solves the problem of finding the shortest paths in a weighted graph. Which algorithm solves this on an unweighted graph?

BFS

Which algorithms can be used to determine strong connectivity for a directed graph? Breadth-first search but not depth-first search Depth-first search but not breadth-first search Breadth-first search or depth-first search Neither breadth-first search nor depth-first search

Breadth-first search or depth-first search

Consider the greedy algorithm that solves the minimize lateness problem. In which order are the requests selected?

By increasing deadline

Interval scheduling sort by

Increasing finish time

Consider the greedy algorithm that solves the interval partitioning problem. What order are the intervals selected.

Increasing start time

Consider the minimize lateness problem. What is the definition of the lateness l, of a request?

L sub i = max(f sub i - d sub i , 0)

What is the running time that we aim for when implementing the priority queue operations add and delete?

O(log n)

Consider an iterative implemental of breadth-first search and a graph with n nodes and m edges. Which one of the following best describes the running time? O(n) O(m + n) O(mn) O(m)

O(m + n)

Which one of the following best describes the running time required to compute the topological ordering of a DAG?

O(m + n)

Which one of the following best describes the running time required to test a graph for bipartiteness? O(n) O(m) O(m + n) O(mn)

O(m + n)

Consider a greedy algorithm that solves the problem of minding a minimum spanning tree of a graph. Which one of the following best describes the asymptotic running time?

O(m log n)

Consider an iterative implementation of DFS and a graph with n nodes and m edges. Which one of the following describes the number of nodes that will be added to the linear data structure?

O(m)

Consider the adjacency list representation of a graph G with n nodes and m edges. Which one of the following best describes the space requirement of the representation?

O(m+n)

RT to compute topo order

O(m+n)

What is the running time of the sorting algorithm heapsort?

O(n log n)

Consider the adjacency matrix representation of a graph G with n nodes and m edges. Which one of the following best describes the space requirement of the representation?

O(n^2)

Consider the minimize lateness problem and the greedy algorithm that solves it. Which one of the following is not true regarding the schedule produced?

Only requests that meet their deadline have been scheduled.

Consider minimize lateness

Optimal schedule with no inversions and no idle time.

Consider the optimal implementation of the greedy algorithm that solves the interval partitioning problem. What data structure is used?

Priority Queue

Which data structure is needed in an efficient implementation of Dijkstra's algorithm?

Priority Queue

Which technique was used to prove that the procedure heapify up restores the heap property when starting with almost a heap?

Proof by induction

Data type to implement BFS

Queue

Let G = (V, E) be an undirected graph and s and t two nodes, such that we have s-t connectivity in the graph. Call S the set of nodes reachable from s in a breadth-first search. Which one of the following best describes the set of nodes R, reachable from t in a breadth-first search?

R and S contain exactly the same nodes

Method used to compute topological ordering of a DAG?

Recursive procedure

Which one of the following best describes the procedure heapify down?

Recursively moves a too large element downwards by swapping it with its smallest child in the tree, until the heap order is restored

Goal of the interval partitioning problem?

Schedule all requests using as few resources as possible.

Goal of interval scheduling problem?

Schedule as many non-overlapping requests as possible.

Which one of the following operations on a priority queue can be performed in constant time, assuming the best over-all implementation?

Select the element with the smallest key

Data type to implement DFS

Stack

Consider an optimization problem where the goal is to find the solution with the minimal cost. Which one of the following best describes the exchange argument proof technique?

Start with an optimal solution Exchange pieces without increasing the cost Argue that any optimal solution can be transformed into the greedy solution This proves that the greedy solution is also an optimal solution

Exchange argument proof technique.

Start with an optimal solution.

We are using a breadth-first search starting in s to determine s-t-connectivity in a graph G. Which one of the following best describes the stopping condition?

Stop when t is found or all connected nodes are visited

Consider the greedy algorithm that solves the interval partitioning problem. Which proof technique was used to prove optimality of the algorithm?

Structural Bound

Which one of the following statements regarding the adjacency matrix and the adjacency list is true?

The adjacency list is a sparse representation of the adjacency matrix.

Three out of these four statement correctly describes any greedy algorithm. Which one does not?

The algorithm has linear running time.

Assuming the most efficient implementation for each one of the following algorithms, which one has the fastest asymptotic running time?

The algorithms can all be implemented to have the same asymptotic running time

Consider a consecutive inversion, two jobs scheduled as positions i and j with

The new lateness of job i cannot exceed the previous lateness of job j.

In the proof of correctness of Dijkstra's algorithm, we use induction on k. What does k represent?

The number of explored nodes

Consider the problem of finding the minimum spanning tree of a weighted graph G = (V, E). An algorithm starts with the graph G and removes edges in order of decreasing cost. An edge will not be removed if its removal disconnects the graph. What is the name of the algorithm described?

The reverse-delete algorithm

Consider the problem of finding the minimum spanning tree of a weighted graph G = (V, E). An algorithm starts in a node s and successively adds edges from E to a partial tree in order of increasing cost. Any edge that connects two nodes already present in the tree is discarded. What is the name of the algorithm described?

The reverse-delete algorithm(wrong) Kruskals algorithm(wrong)

Consider the proof of optimality for the greedy algo. That solves the interval scheduling problem. The greedy solution A is compared to an optimal solution O. Both are ordered by increasing start and finish times. Wha property

The rth interval in the greedy algorithm has an earlier finish time than the rth interval in the optimal solution.

Consider the proof of optimality for the greedy algorithm that solves the interval scheduling problem. The greedy solution A is compared to an optimal solution O. Both are ordered by increasing start and finish times. What property of the greedy solution that is true for any index r ≤ k is used to prove optimality?

The rth interval in the greedy algorithm has an earlier finish time than the rth interval in the optimal solution.

Which one of the following statements regarding the optimized algorithm that computes the topological ordering of a DAG is not true?

The topological ordering needs to be unique for the algorithm to work.

Which one of the following statements best describes the number of edges in a tree with n nodes?

There are exactly n - 1 edges

Which one of the following statements regarding optimal solutions is true?

There is an optimal schedule with no inversions and no idle time.

Which one of the following does not imply that the graph is strongly connected? There is at least one pair of mutually reachable nodes. For every pair of nodes u and v, there is a path from u to v and from v to u. There exists one node that is mutually reachable with every other node in the graph. Every pair of nodes is mutually reachable.

There is at least one pair of mutually reachable nodes.

We have seen that graph search can be used to visit all the nodes in a graph

To determine connectivity

Which one of the following statements regarding the optimized algorithm that computes the topo order is not true?

Topo order needs to be unique

Which one of the following priority queue operations requires an additional array, besides the array representing the heap?

Update the key of a given element

Which one of the following best describes almost a heap - too big?

We have a heap with the exception of one element that is too big. There is some value B such that setting the too big value to B would make the data structure a heap.

Consider the problem of finding a MST in a graph what can the cut property be used for

We use the cut property to show that each addition of an edge in Kruskal's Algorithm is justified

Which one of the following graph search implementation does not exist? iterative depth-first search recursive breadth-first search iterative breadth-first search recursive depth-first search

recursive breadth-first search

What can cycle property be used for?

to show that each removal of an edge in the reverse-delete algo in justified.


Kaugnay na mga set ng pag-aaral

Milady's Standard Cosmetology Chapter 11: TRICHOLOGY

View Set

Chapter 04: Communication and Physical Assessment of the Child and Family

View Set

Econ 221 Chapter 23 practice quiz

View Set

Chapter 19. The Cardiovascular System: The Blood-Companion Site Quiz

View Set

Cosmetology/ bones of the head, neck, and upper body

View Set

Business Writing and Document Production

View Set

Hypersensitivity and Hemolytic Disease of Newborn

View Set

Phar Ch 41-43 Antitubercular, Ch. 42, 43 ANTIFUNGAL, ANTIMALARIAL, ANTIPROTOZOAL, ANTIHELMINTIC (LILLEY

View Set

Chapter Two Terms from Powerpoint

View Set

South Africa The first black president

View Set

Module 5 - Information Security Basics - AWR-173-W

View Set