Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
Question
Book Icon
Chapter 25, Problem 1P

(a)

Program Plan Intro

To show that the updation procedure of transitive closer G * ( V , E *) of graph G ( V, E ) will take O ( V2 ) time, while an edge is added to the graph G .

(a)

Expert Solution
Check Mark

Explanation of Solution

Here, in the graph G , if the updation of transitive closure takes O ( V2 ) time. To understand this scenario, suppose, addition of an edge ( x1 , x2 ) is performed in the graph G . Now, take the set of vertices ( u, v ) in order to get the path from u to x1 and x2 to v . If there is a possibility of having an edge that contains vertices in such manner like ( u , x1 ) and ( x2 , v ).

Therefore, perform addition of an edge ( u, v ) in transitive closure only if the closure holds the edges in ( u, x1 ) and ( x2, v ) manner. So, the consideration of pair required only once and the total run time of this procedure will be O ( V2 ).

(b)

Program Plan Intro

To give an example that the update of transitive closer will take O ( V2 ) time, when a new edge ‘ e’ is added to the graph G .

(b)

Expert Solution
Check Mark

Explanation of Solution

Consider the condition where there aretwo strongly connected components with sizes | V |/2 and there is no common edge between them. The transitive closure can be computed by adding these two connected components of the graph.

Now, perform addition of a single edge between two connected components that provide connectivity between two separate components of the graph. Here, it is clearly visible that the total no. of edges will be increased by | V |/4 and the total no of edges will be [| V |/2 + | V |/4]. So, every time while adding a new edge required a constant time at least.

Therefore, the update of transitive closer will take O ( V2 ) time, when a new edge ‘ e’ is added to the graph G .

(c)

Program Plan Intro

To define an algorithm that takes O ( V3 ) time to update the transitive closure of graph G , when an edge is inserted in to the graph.

(c)

Expert Solution
Check Mark

Explanation of Solution

Consider a set of vertices in the graphG , and there is a path between every pair of vertices. Now, while performing an addition of an edge ( u, v ), look at the ancestor of vertex u and add it there. The reason of looking at the ancestor of an edge is to explore the branches of the tree. This procedure will also applicable for the vertex v. through this, it will be very easy to get the already added edges and will only consider those edges in n times mostly.

Since, the edges in the tree required O ( V2 ) time for consideration. Therefore, the total time taken by the algorithm will be O ( V3 ).

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Modular Program Structure. Analysis of Structured Programming Examples. Ways to Reduce Coupling. Based on the given problem, create an algorithm and a block diagram, and write the program code: Function: y=xsin⁡x Interval: [0,π] Requirements: Create a graph of the function. Show the coordinates (x and y). Choose your own scale and show it in the block diagram. Create a block diagram based on the algorithm. Write the program code in Python. Requirements: Each step in the block diagram must be clearly shown. The graph of the function must be drawn and saved (in PNG format). Write the code in a modular way (functions and the main part should be separate). Please explain and describe the results in detail.
Based on the given problem, create an algorithm and a block diagram, and write the program code: Function: y=xsin⁡x Interval: [0,π] Requirements: Create a graph of the function. Show the coordinates (x and y). Choose your own scale and show it in the block diagram. Create a block diagram based on the algorithm. Write the program code in Python. Requirements: Each step in the block diagram must be clearly shown. The graph of the function must be drawn and saved (in PNG format). Write the code in a modular way (functions and the main part should be separate). Please explain and describe the results in detail.
Based on the given problem, create an algorithm and a block diagram, and write the program code: Function: y=xsin⁡x Interval: [0,π] Requirements: Create a graph of the function. Show the coordinates (x and y). Choose your own scale and show it in the block diagram. Create a block diagram based on the algorithm. Write the program code in Python. Requirements: Each step in the block diagram must be clearly shown. The graph of the function must be drawn and saved (in PNG format). Write the code in a modular way (functions and the main part should be separate). Please explain and describe the results in detail.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Text book image
Fundamentals of Information Systems
Computer Science
ISBN:9781305082168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
CMPTR
Computer Science
ISBN:9781337681872
Author:PINARD
Publisher:Cengage
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
Principles of Information Systems (MindTap Course...
Computer Science
ISBN:9781285867168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning