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
bartleby

Concept explainers

Question
Book Icon
Chapter 15.1, Problem 2E
Program Plan Intro

To give a counter example so that the following greedy strategy does not always determine an optimal way to cut rods.

Blurred answer
Students have asked these similar questions
For the problem below, two ”high level” greedy strategy is given. One of the strategies givesa correct solutions, and the other sometimes gives an incorrect solutions. Decide which greedy strategyproduces optimal solutions, and give a proof that it is correct and a counter-example showing the otherstrategy is incorrect.( show proof  and counter example) You are given a list of classes C and a list of classrooms R. Each class c has a positive enrollment E(c)and each room r has a positive integer size S(r) which denotes its capacity. You want to assign eachclass a room in a way that minimizes the total sizes of rooms used. However, the capacity of the roomassigned to a class must be at least the enrollment of the class. You cannot assign two classes to thesame room. Greedy strategy A: Repeat until all classes are assigned, or a class cannot be included in any unassignedroom. Assign the largest unassigned class to the smallest unassigned room larger than or equal to itsenrollment. Greedy…
In the sequence alignment problem, suppose you knew that the input strings were relatively similar, in the sense that there is an optimal alignment that uses at most k gaps, where k is much smaller than the lengths m and n of the strings. Show how to compute the NW score in O((m+n)k) time.
Establish the Shortest-Paths Optimality Conditions in the Proposition P. Then, for any v reachable from s, the value of distTo[v] is the length of some path from s to v, with distTo[v] equal to infinity for all v not reachable from s. Let G be an edge-weighted digraph. s is a source vertex in G. distTo[] is a vertex-indexed array of path lengths in G. These numbers represent the lengths of the shortest pathways if and only if each edge e from v to w satisfies the condition that distTo[w] = distTo[v] + e.weight() (i.e., no edge is eligible).
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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