Operations Research : Applications and Algorithms
4th Edition
ISBN: 9780534380588
Author: Wayne L. Winston
Publisher: Brooks Cole
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
A library must build shelving to shelve 200 4-inch high books, 150 8-inch high books, 300 10-inch high books and 180 12-inch high books. Each book is 0.5 inch thick. The library has several ways to store the books. For example, an 8-inch high shelf may be built to store all books of height less than or equal to 8 inches, and a 12-inch high shelf may be built for the 12-inch books. Alternatively, a 12-inch high shelf might be built to store all books. The library believes it costs $2,300 to build a shelf and that a cost of $5 per square inch is incurred for book storage. (Assume that the area required to store a book is given by height of storage area times book’s thickness.) Formulate and solve a shortest-path problem that could be used to help the library determine how to shelve the books at minimum cost. (Hint: Have nodes 0, 4, 8, 10 and 12, with cij being the total cost of shelving all books of height >i and ≤ j on a single shelf.)
You and your friends decided to hold a “Secret Santa” gift exchange, where each person buys a gift for someone else. To see how this whole thing works, let’s consider the following example. Suppose there are 7 people A, B, C, D, E, F, and G. We denote x → y to mean “x gives a gift to y.” If the gift exchange starts with person A, then they give a gift to E. Then E gives a gift to B. And it is entirely possible that B gives a gift to A; in such a case we have completed a “cycle.” In case a cycle occurs, the gift exchange resumes with another person that hasn’t given their gift yet. If the gift exchange resumes with person D, then they give a gift to G. Then G gives a gift to F. Then F gives a gift to C. Then finally C gives a gift to D, which completes another cycle. Since all of the people have given their gifts, the giftexchange is done, otherwise the gift exchange resumes again with another person. All in all, there are two cycles that occurred during the gift exchange: A → E → B → A…
[Medium]
Suppose, you have been given a non-negative integer which is the height of a ‘house of
cards’. To build such a house you at-least require 8 cards. To increase the level (or height)
of that house, you would require four sides and a base for each level. Therefore, for the top
level, you would require 8 cards and for each of the rest of the levels below you would
require 5 extra cards. If you were asked to build level one only, you would require just 8
cards. Of course, the input can be zero; in that case, you do not build a house at all.
Complete the recursive method below to calculate the number of cards required to build a
‘house of cards’ of specific height given by the parameter.
public int hocBuilder (int height){
// TO DO
}
OR
def hocBuilder(height):
Chapter 8 Solutions
Operations Research : Applications and Algorithms
Knowledge Booster
Similar questions
- Suppose, you have been given a non-negative integer which is the height of a ‘house of cards’. To build such a house you at-least require 8 cards. To increase the level (or height) of that house, you would require four sides and a base for each level. Therefore, for the top level, you would require 8 cards and for each of the rest of the levels below you would require 5 extra cards. If you were asked to build level one only, you would require just 8 cards. Of course, the input can be zero; in that case, you do not build a house at all. Complete the recursive method below to calculate the number of cards required to build a ‘house of cards’ of specific height given by the parameter. there is a picture given in that section. public int hocBuilder (int height){ // TO DO } OR def hocBuilder(height): #TO DOarrow_forwardSuppose, you have been given a non-negative integer which is the height of a ‘house of cards’. To build such a house you at-least require 8 cards. To increase the level (or height) of that house, you would require four sides and a base for each level. Therefore, for the top level, you would require 8 cards and for each of the rest of the levels below you would require 5 extra cards. If you were asked to build level one only, you would require just 8 cards. Of course, the input can be zero; in that case, you do not build a house at all. Complete the recursive method below to calculate the number of cards required to build a ‘house of cards’ of specific height given by the parameter. public int hocBuilder (int height){ // TO DO } OR def hocBuilder(height):arrow_forwardTo cut an 'n' centimeter-long gold bar into 2 pieces costs $n. When a gold bar is cut into many pieces, the order in which the cuts occur can affect the total amount of costs. For example, to cut a 20 centimeter gold bar at length marks 2, 8, and 10 (numbering the length marks in ascending order from the left-hand end, starting from 1). If the cuts to occur in left-to-right order, then the first cut costs $20, the second cut costs $18 (cutting the remaining 18 centimeter bar at originally length mark 8), and the third cut costs $12, totaling $50. If the cuts to occur in right-to-left order, however, then the first cut costs $20 time, the second cut costs $10, and the third cut costs $8, totaling $38. In yet another order, the first cut is at 8 (costing $20), then the 2nd cut is at 2 (costing $8), and finally the third cut is at 10 (costing $12), for a total cost of $40. Given an 'n' centimeter-long gold bar G and an array C[1..m] containing the cutting points in ascending order): a.…arrow_forward
- If the first number in a sequence is a positive integer, x Let ao= x, an is defined as follows if an is even, then an+1 = an/2 if an is odd, then an+1 =3 *an+ 1 Then there exists an integer k, such that ak =1 For example, if: 75, then k = 14 and the numbers in the sequence are: 75, 226, 113, 340, 170, 85, 256, 128, 64, 32, 16, 8, 4, 2, 1. The largest number in the sequence is 340 and it is a position 4 in the sequence (assuming 75 is at position 1) Design and implement a complete C++ program that will • read a series of integers (greater than 0) from a file and for each integer display (to the screen) − the integer − the number of steps it takes to reach 1 − the largest value in the sequence and its positionarrow_forwardLet l be a line in the x-yplane. If l is a vertical line, its equation is x = a for some real number a. Suppose l is not a vertical line and its slope is m. Then the equation of l is y = mx + b, where b is the y-intercept. If l passes through the point (x₀, y₀), the equation of l can be written as y - y₀ = m(x - x₀). If (x₁, y₁) and (x₂, y₂) are two points in the x-y plane and x₁ ≠ x₂, the slope of line passing through these points is m = (y₂ - y₁)/(x₂ - x₁). Instructions Write a program that prompts the user for two points in the x-y plane. Input should be entered in the following order: Input x₁ Input y₁ Input x₂arrow_forwardA Marble Game is played with M marbles on a square board. The board is divided into NxN squares, andM of those squares contain holes. Marbles and holes are numbered from 1 to M. The goal of the Marblegame is to roll each marble into the hole that has the same number. A game board may contain walls.Each wall is one unit long and stands between two adjacent unit squares. Two squares are consideredadjacent if and only if they share a side.At the beginning of the game, all marbles are placed on the board, each in a different square. A “move”consists of slightly lifting a side of the game board. Then all marbles on the board roll downward towardthe opposite side, each one rolling until it meets a wall or drops into an empty hole, or until the nextsquare is already occupied by another marble. Marbles roll subject to the following restrictions: Marbles cannot jump over walls, other marbles, or empty holes Marbles cannot leave the board (The edge is a wall) A unit square can contain at most…arrow_forward
- Consider the problem of making change for n cents using the fewest number of coins. Assume that we live in a country where coins come in k dierent denominations c1, c2, . . . , ck, such that the coin values are positive integers, k ≥ 1, and c1 = 1, i.e., there are pennies, so there is a solution for every value of n. For example, in case of the US coins, k = 4, c1 = 1, c2 = 5, c3 = 10, c4 = 25, i.e., there are pennies, nickels, dimes, and quarters. To give optimal change in the US for n cents, it is sufficient to pick as many quarters as possible, then as many dimes as possible, then as many nickels as possible, and nally give the rest in pennies. Design a bottom-up (non-recursive) O(nk)-time algorithm that makes change for any set of k different coin denominations. Write down the pseudocode and analyze its running time. Argue why your choice of the array and the order in which you fill in the values is the correct one. Notice how it is a lot easier to analyze the running time of…arrow_forwardConsider the problem of making change for n cents using the fewest number of coins. Assume that we live in a country where coins come in k dierent denominations c1, c2, . . . , ck, such that the coin values are positive integers, k ≥ 1, and c1 = 1, i.e., there are pennies, so there is a solution for every value of n. For example, in case of the US coins, k = 4, c1 = 1, c2 = 5, c3 = 10, c4 = 25, i.e., there are pennies, nickels, dimes, and quarters. To give optimal change in the US for n cents, it is sufficient to pick as many quarters as possible, then as many dimes as possible, then as many nickels as possible, and nally give the rest in pennies. Design a bottom-up (non-recursive) O(nk)-time algorithm that makes change for any set of k different coin denominations. Write down the pseudocode and analyze its running time. Argue why your choice of the array and the order in which you ll in the values is the correct one.arrow_forwardConsider the problem of making change for n cents using the fewest number of coins. Assume that we live in a country where coins come in k dierent denominations c1, c2, . . . , ck, such that the coin values are positive integers, k ≥ 1, and c1 = 1, i.e., there are pennies, so there is a solution for every value of n. For example, in case of the US coins, k = 4, c1 = 1, c2 = 5, c3 = 10, c4 = 25, i.e., there are pennies, nickels, dimes, and quarters. To give optimal change in the US for n cents, it is sufficient to pick as many quarters as possible, then as many dimes as possible, then as many nickels as possible, and nally give the rest in pennies. Prove that the coin changing problem exhibits optimal substructure. Design a recursive backtracking (brute-force) algorithm that returns the minimum number of coins needed to make change for n cents for any set of k different coin denominations. Write down the pseudocode and prove that your algorithm is correct.arrow_forward
- A safe is locked by a combination of of four binary digits (that is, 0 or 1), but theowner has forgotten the combination. The safe is designed in such a way that nomatter how many digits have been pressed, if the correct combination of three digitsis pressed at any point, then the safe automatically opens (there is no ”enter” key).Our goal is to find the minimum number of digits that one needs to key in in order toguarantee that the safe opens. In other words, we wish to find the smallest possiblelength of a binary sequence containing every four-digit sequence in it.(a) Create a digraph whose vertex set consists of three-digit binary sequences. Fromeach vertex labelled xyz, there is one outgoing edge (labelled 0) leading to vertexyz0, and another outgoing edge (labelled 1) leading to vertex yz1.(b) Explain why every edge represents a four digit sequence and why an Euleriantour of this graph represents the desired sequence of keystrokes.(c) Find the minimum number of digits that one…arrow_forwardSuppose, you have been given a non-negative integer which is the height of a ‘house ofcards’. To build such a house you at-least require 8 cards. To increase the level (or height)of that house, you would require four sides and a base for each level. Therefore, for the toplevel, you would require 8 cards and for each of the rest of the levels below you wouldrequire 5 extra cards. If you were asked to build level one only, you would require just 8cards. Of course, the input can be zero; in that case, you do not build a house at all.Complete the recursive method below to calculate the number of cards required to builda ‘house of cards’ of specific height given by the parameter.arrow_forwardImagine there are N teams competing in a tournament, and that each team plays each of the other teams once. If a tournament were to take place, it should be demonstrated (using an example) that every team would lose to at least one other team in the tournament.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks ColeC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning