Tom, COMP1511's Course Administrator, has started a new business -- laying internet pipes for the NBN....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Tom, COMP1511's Course Administrator, has started a new business -- laying internet pipes for the NBN. The pipes have already been laid out in sections side by side, but they have arrived out of order and so they aren't connected properly. He wants to rearrange them into an order where they connect, and are as long as possible. When you have implemented this question, you will be able to take an input like this: | | \ / | | | | | III 11 11 And turn it into an output like this: | \ / | LIINT \ 1 X 1 / \\ \ \ LIIN You can do this by following the rules described below... Pipes and Connections There are three types of pipes: (the "straight" pipe) this pipe connects from the pipe above, to the pipe below. ./ (a "left" pipe) this pipe connects from the pipe above, to one space diagonally down and left. 1 (a "right" pipe) this pipe connects from the pipe above, to one space diagonally down and right. Pipe Rows and Ordering Each line of standard input will be a section of pipes. You cannot edit any of these lines, but you will need to change the order that they are printed out so that they connect correctly to the pipes above them. The first line of standard input will always be the first section of pipes and must be printed out first. After the first line, you should print them out the rest of the lines so that as many pipes as possible connect to the pipes above, and so that the pipes go on as long as possible. Order the rows so that the following rules are followed: 1. The next section of pipe must not ever contain a pipe that the previous section doesn't connect to. 2. If multiple sections of pipe could come next, the next section should maximize the number of pipes that continue from the last section. 3. If multiple sections of pipe could still come next, the next section should have as many straight pipes as possible. 4. If multiple sections of pipe could still come next, the section of pipe that was described earliest on standard input should be used. 5. If no sections of pipe could come next, end your program. Restrictions • If a left pipe is in the left-most space, that pipe ends there. • If a right pipe is in the right-most space, that pipe ends there. • You are guaranteed that each line will be equally long, and no line will be longer than 1000 characters. • You are guaranteed that there will be no more than 1000 lines. • The only characters that will appear on a line will be the three pipe characters or space. Lines will end with a newline. Tom, COMP1511's Course Administrator, has started a new business -- laying internet pipes for the NBN. The pipes have already been laid out in sections side by side, but they have arrived out of order and so they aren't connected properly. He wants to rearrange them into an order where they connect, and are as long as possible. When you have implemented this question, you will be able to take an input like this: | | \ / | | | | | III 11 11 And turn it into an output like this: | \ / | LIINT \ 1 X 1 / \\ \ \ LIIN You can do this by following the rules described below... Pipes and Connections There are three types of pipes: (the "straight" pipe) this pipe connects from the pipe above, to the pipe below. ./ (a "left" pipe) this pipe connects from the pipe above, to one space diagonally down and left. 1 (a "right" pipe) this pipe connects from the pipe above, to one space diagonally down and right. Pipe Rows and Ordering Each line of standard input will be a section of pipes. You cannot edit any of these lines, but you will need to change the order that they are printed out so that they connect correctly to the pipes above them. The first line of standard input will always be the first section of pipes and must be printed out first. After the first line, you should print them out the rest of the lines so that as many pipes as possible connect to the pipes above, and so that the pipes go on as long as possible. Order the rows so that the following rules are followed: 1. The next section of pipe must not ever contain a pipe that the previous section doesn't connect to. 2. If multiple sections of pipe could come next, the next section should maximize the number of pipes that continue from the last section. 3. If multiple sections of pipe could still come next, the next section should have as many straight pipes as possible. 4. If multiple sections of pipe could still come next, the section of pipe that was described earliest on standard input should be used. 5. If no sections of pipe could come next, end your program. Restrictions • If a left pipe is in the left-most space, that pipe ends there. • If a right pipe is in the right-most space, that pipe ends there. • You are guaranteed that each line will be equally long, and no line will be longer than 1000 characters. • You are guaranteed that there will be no more than 1000 lines. • The only characters that will appear on a line will be the three pipe characters or space. Lines will end with a newline.
Expert Answer:
Answer rating: 100% (QA)
To solve this problem we can follow the rules given and implement a search algorithm that tries to find the next line that should be printed based on ... View the full answer
Related Book For
International Business
ISBN: 978-0470530658
8th edition
Authors: Michael Czinkota, Iikka A. Ronkainen, Michael H. Moffett
Posted Date:
Students also viewed these accounting questions
-
Compare and contrast two different points of view on expanding trade by accessing the website of the U.S. Chamber of Commerce, an industry coalition promoting increased to and from world markets...
-
1. Compare and contrast two different points of view on expanding trade by accessing the websites of the us chamber of commerce (an industry coalition promoting increased access to and from world...
-
There are plenty of good sites that show current and past spot rates of exchange. One excellent site is the Pacific Exchange Rate Service of Sauder School of Business, University of British Columbia,...
-
Builder Products, Incorporated, uses the weighted-average method in its process costing system. It manufactures a caulking compound that goes through three processing stages prior to completion....
-
The following information applies to Babydoll Companys defined benefit pension plan at December 31, year 8: Projected benefit obligation, December 31, year 7. $ 2,000,000 Projected benefit...
-
1. Parallel light rays cross interfaces from medium 1 into medium 2 and then into medium 3 as shown in Fig. 23-51. What can we say about the relative sizes of the indices of refraction of these...
-
Out of the three most important factors that influence where people shop, why is convenience probably the one that retailers should focus on the most (instead of product and price)?
-
Prepare a journal entry to record each of the following materials transactions: a. Total materials purchased on account during the month amounted to $200,000. b. Direct materials requisitioned for...
-
Tony and Suzie see the need for a rugged all-terrain vehicle to transport participants and supplies. They decide to purchase a used Suburban on July 1, 2025, for $14,800. They expect to use the...
-
Gold Enterprises acquired 100 percent of Premium Builders stock on December 31, 20X4. Balance sheet data for Gold and Premium on January 1, 20X5, are as follows: At the date of the business...
-
If you connected your laptop to a wireless hotspot, opened your email program and sent an email to someone, what connections would you make? 1. Describe the series of connections that would be made,...
-
Discuss objectives of an organization's internal control system. Discuss the 5 components of internal control.
-
Stormiez Camping Supply sells tents. The company has the following income statement. Sales ($1,000 per unit) $200,000 Less Cost of Goods sold ($475 per unit) 95,000 Gross margin 105,000 Less...
-
Golden State CPA firm leases tax software from Low Tax Software Company to prepare federal and state income tax returns. The lease agreement calls for a base charge of $5,000 per year plus $100 per...
-
How did Amazon grow (focus on products/services): - During the dot com boom (late1990s to the early2000s) ? - After the dot com bust (early2000s to mid2000s) ? - Recently ? Where are the similarities...
-
How does the process of alternative splicing contribute to proteomic diversity, and what are some examples of diseases caused by aberrant splicing ?
-
Exercise equipment company produces a range of exercise equipment. All the equipment is manufactured locally, and currently the business promotes its equipment as a premium brand. Sales growth is...
-
The cash records of Holly Company show the following four situations. 1. The June 30 bank reconciliation indicated that deposits in transit total $720. During July, the general ledger account Cash...
-
Many companies, such as Cultural Savvy, provide cross-cultural consulting and coaching, and training. Using the companys web site (www.culturalsavvy.com), assess the different ways such consultants...
-
Go to the World Bank web site (www.worldbank.org) to obtain an overview of the banks purpose and programs. Search for criticism of bank programs on other web sites and prepare a short report on the...
-
In addition to teenagers as a global segment, are there possibly other such groups with similar traits and behaviors that have emerged worldwide?
-
As the marketing manager for Independent Packaging Pty Ltd, you have asked the accountant what it costs to make the Container2000 model because you want to set a price for the container. A similar...
-
Incomplete information concerning the financial performance of two manufacturing companies is presented below. Required Determine the answers to (a) to(f) for the two companies. Work in process,...
-
Smart Manufacturing Systems Pty Ltd uses a periodic inventory system and closes its accounts on 30 June each year. The companys closing entries made on 30 June 2025 were as shown below. Required (a)...
Study smarter with the SolutionInn App