Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Algorithms, Computer Programming 1. For parts (a) through (d), consider the following two algorithms that determine the number of 1 ft 2 tiles required to

Algorithms, Computer Programming

1. For parts (a) through (d), consider the following two algorithms that determine the number of 1 ft2 tiles required to fill an empty room:

Algorithm 1: Places tiles in the room, one at a time, until the entire room is full of tiles. Each time a tile is placed in the room, a counter is incremented by 1. The final value of the counter is the number of tiles required to fill the room.

Algorithm 2: Places tiles in the room, one at a time, along the edge of two adjacent walls. Each time a tile is placed in the room, a counter is incremented by 1. A single calculation is then made to compute the area of the room by multiplying the number of tiles placed across the floor along one wall by the number of tiles placed across the floor along the adjacent wall. The result of this single calculation is the number of tiles required to fill the room.

For parts (a) and (b), suppose that it takes 1 second to lay one tile in the room and 60 seconds to perform a single calculation. Note that incrementing a counter is not considered a calculation.

(a) How long (in hours) does Algorithm 1 take to determine the number of tiles required to fill an empty room that is 16 ft wide by 225 ft long? Include all units and show all work.

(b) How long (in seconds) does Algorithm 2 take to determine the number of tiles required to fill the same 16 ft wide by 225 ft long empty room? Include all units and show all work.

(c) Suppose that Algorithm 1 takes 1.5 hours and Algorithm 2 takes 300 seconds. Which algorithm is faster? How many times faster is it? Calculate your answer to a maximum of two decimal places. Include all units and show all work.

(d) Represent Algorithm 1 using a flowchart. You do not need to get into the details of determining when the edge of a wall is full of tiles. Essentially, represent the algorithm as it is described.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

Describe Balor method and give the chemical reaction.

Answered: 1 week ago

Question

How to prepare washing soda from common salt?

Answered: 1 week ago

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago