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 24.3, Problem 4E
Program Plan Intro

To give an O(V+E) algorithm to check the output of the professor Dijkshtra’s program.

Blurred answer
Students have asked these similar questions
Given a graph G = (V, E), let us call G an almost-tree if G is connected and G contains at most n + 12 edges, where n = |V |. Each edge of G has an associated cost, and we may assume that all edge costs are distinct. Describe an algorithm that takes as input an almost-tree G and returns a minimum spanning tree of G. Your algorithm should run in O(n) time.
You are given a tree T with n vertices, rooted at vertex 1. Each vertex i has an associated value ai , which may be negative. You wish to colour each vertex either red or black. However, you must ensure that for each pair of red vertices, the path between them in T consists only of red vertices.Design an algorithm which runs in O(n) time and finds the maximum possible sum of values of red vertices, satisfying the constraint above.
Given an undirected weighted graph G with n nodes and m edges, and we have used Prim’s algorithm to construct a minimum spanning tree T. Suppose the weight of one of the tree edge ((u, v) ∈ T) is changed from w to w′, design an algorithm to verify whether T is still a minimum spanning tree. Your algorithm should run in O(m) time, and explain why your algorithm is correct. You can assume all the weights are distinct. (Hint: When an edge is removed, nodes of T will break into two groups. Which edge should we choose in the cut of these two groups?)
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education