All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Study Help
New
Search
Search
Sign In
Register
study help
computer science
introduction to algorithms
Questions and Answers of
Introduction to Algorithms
We wish to augment a Fibonacci heap H to support two new operations without changing the amortized running time of any other Fibonacci-heap operations.a. The operation FIB-HEAP-CHANGE-KEY(H, x, k)
Modify the data structures in this section to support duplicate keys.
Write pseudocode for PROTO-VEB-DELETE. It should update the appropriate summary bit by scanning the related bits within the cluster. What is the worstcase running time of your procedure?
Modify vEB trees to support keys that have associated satellite data.
Modify the data structures in this section to support keys that have associated satellite data.
Observe that, using the structures in this section, the way we find the successor and predecessor of a value x does not depend on whether x is in the set at the time. Show how to find the successor
Add the attribute n to each proto-vEB structure, giving the number of elements currently in the set it represents, and write pseudocode for PROTO-VEB-DELETE that uses the attribute n to decide when
Write pseudocode for a procedure that creates an empty van Emde Boas tree.
Suppose that instead of superimposing a tree of degree √u, we were to superimpose a tree of degree u1/k, where k > 1 is a constant. What would be the height of such a tree, and how long would
Modify the proto-vEB structure to support duplicate keys.
What happens if you call VEB-TREE-INSERT with an element that is already in the vEB tree? What happens if you call VEB-TREE-DELETE with an element that is not in the vEB tree? Explain why the
Modify the proto-vEB structure to support keys that have associated satellite data.
Suppose that instead of ↑√u clusters, each with universe size ↓√u, we constructed vEB trees to have u1/k clusters, each with universe size u1-1/k, where k >
Write pseudocode for a procedure that creates a proto-νEB(u) structure.
Creating a vEB tree with universe size u requires O(u) time. Suppose we wish to explicitly account for that time. What is the smallest number of operations n for which the amortized time of each
Argue that if line 9 of PROTO-VEB-MINIMUM is executed, then the proto-vEB structure is empty.
Suppose that we designed a proto-vEB structure in which each cluster array had only u1/4 elements. What would the running times of each operation be?
Suppose that CONNECTED-COMPONENTS is run on the undirected graph G = (V, E), where V = 〈a, b, c, d, e, f, g, h, i, j, k〉 and the edges of E are processed in the order (d, i), (f, k), (g, i), (b,
Write pseudocode for MAKE-SET, FIND-SET, and UNION using the linked-list representation and the weighted-union heuristic. Make sure to specify the attributes that you assume for set objects and list
Show that after all edges are processed by CONNECTED-COMPONENTS, two vertices are in the same connected component if and only if they are in the same set.
Show the data structure that results and the answers returned by the FIND-SET operations in the following program. Use the linked-list representation with the weighted-union heuristic. Assume that
Write a nonrecursive version of FIND-SET with path compression.
Prove that every node has rank at most ⌊lg n⌋.
During the execution of CONNECTED-COMPONENTS on an undirected graph G = (V, E) with k connected components, how many times is FIND-SET called? How many times is UNION called? Express your answers in
Make a 3-by-3 chart with row and column labels WHITE, GRAY, and BLACK. In each cell (I, j), indicate whether, at any point during a depth-first search of a directed graph, there can be an edge from a
How can the number of strongly connected components of a graph change if a new edge is added?
Given an adjacency-list representation of a directed graph, how long does it take to compute the out-degree of every vertex? How long does it take to compute the in-degrees?
Show how depth-first search works on the graph of Figure 22.6. Assume that the?for?loop of lines 5-7 of the DFS procedure considers the vertices in alphabetical order, and assume that each adjacency
Give a linear-time algorithm that takes as input a directed acyclic graph G = (V, E) and two vertices s and t, and returns the number of simple paths from s to t in G. For example, the directed
Give an adjacency-list representation for a complete binary tree on 7 vertices. Give an equivalent adjacency-matrix representation. Assume that vertices are numbered from 1 to 7 as in a binary heap.
Let G = (V, E) be a connected, undirected graph. An articulation point of G is a vertex whose removal disconnects G. A bridge of G is an edge whose removal disconnects G. A biconnected component of G
Professor Bacon claims that the algorithm for strongly connected components would be simpler if it used the original (instead of the transpose) graph in the second depth-first search and scanned the
The transpose of a directed graph G = (V, E) is the graph GT = (V, ET), where ET = {(ν, u) ∈ V × V : (u, ν) ∈ E}. Thus, GT is G with all its edges reversed.
What is the running time of BFS if we represent its input graph by an adjacency matrix and modify the algorithm to handle this form of input?
Prove or disprove: If a directed graph G contains cycles, then TOPOLOGICAL-SORT (G) produces a vertex ordering that minimizes the number of “bad” edges that are inconsistent with the ordering
Prove that for any directed graph G, we have ((GT)SCC)T = GSCC. That is, the transpose of the component graph of GT is the same as the component graph of G.
Given an adjacency-list representation of a multi-graph G = (V, E), describe an O(V + E)-time algorithm to compute the adjacency-list representation of the "equivalent" undirected graph G′ = (V,
The square of a directed graph G = (V, E) is the graph G2 = (V, E2) such that (u, ν) ∈ E2 if and only G contains a path with
Show that in an undirected graph, classifying an edge (u, ν) as a tree edge or a back edge according to whether (u, ν) or (ν, u) is encountered first during the depth-first search is equivalent to
The diameter of a tree T = (V, E) is defined as maxu,ν∈V δ(u, ν), that is, the largest of all shortest-path distances in the tree. Give an efficient algorithm
Suppose that instead of a linked list, each array entry Adj[u] is a hash table containing the vertices ν for which (u, ν) ∈ E. If all edge lookups are equally likely, what is the expected time to
Let G = (V, E) be a connected, undirected graph. Give an O(V + E)-time algorithm to compute a path in G that traverses each edge in E exactly once in each direction. Describe how you can find your
Modify the pseudocode for depth-first search so that it prints out every edge in the directed graph G, together with its type. Show what modifications, if any, you need to make if G is undirected.
A directed graph G = (V, E) is singly connected if u ⤳ ν implies that G contains at most one simple path from u to ν for all vertices u, ν ∈ V. Give an efficient algorithm to determine whether
Professor Sabatier conjectures the following converse of Theorem 23.1. Let G = (V, E) be a connected, undirected graph with a real-valued weight function w defined on E. Let A be a subset of E that
For a very sparse connected graph G = (V, E), we can further improve upon the O(E + V lg V) running time of Prim's algorithm with Fibonacci heaps by preprocessing G to decrease the number of vertices
Show that if an edge (u, ν) is contained in some minimum spanning tree, then it is a light edge crossing some cut of the graph.
A bottleneck spanning tree T of an undirected graph G is a spanning tree of G whose largest edge weight is minimum over all spanning trees of G. We say that the value of the bottleneck spanning tree
In this problem, we give pseudocode for three different algorithms. Each one takes a connected graph and a weight function as input and returns a set of edges T. For each algorithm, either prove that
For a sparse graph G = (V, E), where |E| = Θ(V), is the implementation of Prim’s algorithm with a Fibonacci heap asymptotically faster than the binary-heap implementation? What about for a dense
Let e be a maximum-weight edge on some cycle of connected graph G = (V, E). Prove that there is a minimum spanning tree of G′ = (V, E – {e}) that is also a minimum spanning tree of G. That is,
Suppose that the edge weights in a graph are uniformly distributed over the halfopen interval [0, 1]. Which algorithm, Kruskal’s or Prim’s, can you make run faster?
Argue that if all edge weights of a graph are positive, then any subset of edges that connects all vertices and has minimum total weight must be a tree. Give an example to show that the same
Suppose that we represent the graph G = (V, E) as an adjacency matrix. Give a simple implementation of Prim’s algorithm for this case that runs in O(V2) time.
Kruskal’s algorithm can return different spanning trees for the same input graph G, depending on how it breaks ties when the edges are sorted into order. Show that for each minimum spanning tree T
Let T be a minimum spanning tree of a graph G, and let L be the sorted list of the edge weights of T. Show that for any other minimum spanning tree T′ of G, the list L is also the sorted list of
Professor Borden proposes a new divide-and-conquer algorithm for computing minimum spanning trees, which goes as follows. Given a graph G = (V, E), partition the set V of vertices into two sets V1
Let T be a minimum spanning tree of a graph G = (V, E), and let V′be a subset of V. Let T′be the subgraph of T induced by V′, and let G′ be the subgraph of G induced by V′. Show that if
Find a feasible solution or determine that no feasible solution exists for the following system of difference constraints: X1 – X2 < 1, X1 – X4 < -4, 2, X2 – X3 < 1. X2 - X5 < X2 – X6 < 5,
Find a feasible solution or determine that no feasible solution exists for the following system of difference constraints: X1 – X2 < 4, X1 – X5 < 5, X2 - X4 < -6, 1, X3 – X2 < X4 – X1 3, 5,
Give an example of a weighted, directed graph G = (V, E) with weight function w : E → ℝ and source vertex s such that G satisfies the following property: For every edge (u, ν) ∈ E, there is a
Suppose we change line 3 of DAG-SHORTEST-PATHS to read 3 for the first |V| - 1 vertices, taken in topologically sorted order Show that the procedure would remain correct.
Can any shortest-path weight from the new vertex ν0 in a constraint graph be positive? Explain.
Modify the Bellman-Ford algorithm so that it sets ν.d to -∞ for all vertices ν for which there is a negative-weight cycle on some path from the source to ν.
Give an efficient algorithm to count the total number of paths in a directed acyclic graph. Analyze your algorithm.
Let G = (V, E) be a directed graph with weight function w : E ⇾ R, and let n = |V|. We define the mean weight of a cycle c = 〈e1, e2, . . . , ek〉 of edges in E to beLet μ* = minc μ(c), where
Show how to modify the Bellman-Ford algorithm slightly so that when we use it to solve a system of difference constraints with m inequalities on n unknowns, the running time is O(n m).
Let G = (V, E) be a weighted, directed graph with no negative-weight edges. Let s ∈ V be the source vertex, and suppose that we allow v.π to be the predecessor of ν on any shortest path to ν
Let G = (V, E) be a weighted, directed graph with weight function w : E → ℝ. Give an O(V E)-time algorithm to find, for each vertex ν ∈ V , the value δ∗(ν) = minu∈V {δ(u, ν)}.
Suppose that in addition to a system of difference constraints, we want to handle equality constraints of the form xi = xj + bk. Show how to adapt the Bellman-Ford algorithm to solve this variety of
Let G = (V, E) be a weighted, directed graph with weight function w : E → ℝ and no negative-weight cycles. Let s ∈ V be the source vertex, and let G be initialized by
Suppose that a weighted, directed graph G = (V, E) has a negative-weight cycle. Give an efficient algorithm to list the vertices of one such cycle. Prove that your algorithm is correct.
Let G = (V, E) be a weighted, directed graph with positive weight function w : E → {1, 2, . . . ,W} for some positive integer W, and assume that no two vertices have the same shortest-path weights
Let Ax ≤ b be a system of m difference constraints in n unknowns. Show that the Bellman-Ford algorithm, when run on the corresponding constraint graph, maximizes Σn1=1 xi subject to Ax ≤ b
Show that the Bellman-Ford algorithm, when run on the constraint graph for a system Ax ≤ b of difference constraints, minimizes the quantity (max {xi} – min {xi}) subject to Ax ≤ b. Explain how
Suppose that we are given a weighted, directed graph G = (V, E) in which edges that leave the source vertex s may have negative weights, all other edge weights are nonnegative, and there are no
Give an efficient algorithm to solve a system Ax ≤ b of difference constraints when all of the elements of b are real-valued and all of the unknowns xi must be integers.
Give an efficient algorithm to solve a system Ax ≤ b of difference constraints when all of the elements of b are real-valued and a specified subset of some, but not necessarily all, of the unknowns
What is the purpose of adding the new vertex s to V , yielding V′?
A graph G = (V, E) is ∈-dense if |E| = Θ(V 1+∈) for some constant ∈ in the range 0 < ∈ ≤ 1. By using d-ary min-heaps in shortest-paths algorithms on ∈-dense graphs, we can match the
Why do we require that wi i = 0 for all 1 ≤ i ≤ n?
Suppose that w(u, ν) ≥ 0 for all edges (u, ν) ∈ E. What is the relationship between the weight functions w and ŵ?
Show that matrix multiplication defined by EXTEND-SHORTEST-PATHS is associative.
Suppose that we modify the way in which equation (25.7) handles equality: Is this alternative definition of the predecessor matrix ? correct? d*-1) + d&-1) if d < (k-1) (k –1) –1) (k) Tij kj 7
Suppose that we run Johnson’s algorithm on a directed graph G with weight function w. Show that if G contains a 0-weight cycle c, then ŵ(u, ν) = 0 for every edge (u, ν) in c.
Suppose we also wish to compute the vertices on shortest paths in the algorithms of this section. Show how to compute the predecessor matrix … from the completed matrix ∏ of shortest-path weights
We can also compute the vertices on shortest paths as we compute the shortest-path weights. Define π(m)ij as the predecessor of vertex j on any minimum-weight path from i to j that contains at most
Give an O(VE)-time algorithm for computing the transitive closure of a directed graph G = (V, E).
The FASTER-ALL-PAIRS-SHORTEST-PATHS procedure, as written, requires us to store ⌈lg(n – 1⌉ matrices, each with n2 elements, for a total space requirement of Θ(n2 lg n). Modify the procedure to
Suppose that we can compute the transitive closure of a directed acyclic graph in f (|V|, |E|) time, where f is a monotonically increasing function of |V| and |E|. Show that the time to compute the
Modify FASTER-ALL-PAIRS-SHORTEST-PATHS so that it can determine whether the graph contains a negative-weight cycle.
An n ? n grid is an undirected graph consisting of n rows and n columns of vertices, as shown in Figure 26.11. We denote the vertex in the i th row and the j th column by (I, j). All vertices in a
We would like to implement a push-relabel algorithm in which we maintain a first in, first-out queue of overflowing vertices. The algorithm repeatedly discharges the vertex at the head of the queue,
Extend the flow properties and definitions to the multiple-source, multiple-sink problem. Show that any flow in a multiple-source, multiple-sink flow network corresponds to a flow of identical value
Show how to implement the generic push-relabel algorithm using O(V) time per relabel operation, O(1) time per push, and O(1) time to select an applicable operation, for a total time of O(V2E).
Show that the generic algorithm still works if RELABEL updates u.h by simply computing u.h = u.h + 1. How would this change affect the analysis of RELABEL-TO-FRONT?
Show that if we always discharge a highest overflowing vertex, we can make the push-relabel method run in O(V3) time.
Suppose that at some point in the execution of a push-relabel algorithm, there exists an integer 0 < k ≤ |V| − 1 for which no vertex has ν.h = k. Show that all vertices with ν.h > k are
State the maximum-flow problem as a linear-programming problem.
We say that a bipartite graph G = (V, E), where V = L ⋃ R, is d-regular if every vertex ν ∈ V has degree exactly d. Every d-regular bipartite graph has |L| = |R|. Prove that every d-regular
Showing 700 - 800
of 1549
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Last