Program represent an algorithm in the strict sense

Assignment Help Business Management
Reference no: EM131687849

1. Design an algorithm for finding all the factors of a positive integer. For example, in the case of the integer 12, your algorithm should report the values 1, 2, 3, 4, 6, and 12.

2. Does the following program represent an algorithm in the strict sense? Why or why not?

Count = 0

while (Count != 5):

    Count = Count + 2

3. Rewrite the following program segment using a repeat structure rather than a while structure. Be sure the new version prints the same values as the original.

Count = 2

while (Count < 7):

  print(Count)

  Count = Count + 1

4. The following program segment is designed to compute the product of two nonnegative integers X and Y by accumulating the sum of X copies of Y; that is, 3 times 4 is computed by accumulating the sum of three 4s. Is the program segment correct? Explain your answer.

Product = 0

Count = 0

repeat:

   Product = Product + Y

   Count = Count + 1

until (Count == X)

5. Design an algorithm that, when given an arrangement of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, rearranges the digits so that the new arrangement represents the next larger value that can be represented by these digits (or reports that no such rearrangement exists if no rearrangement produces a larger value). Thus 5647382901 would produce 5647382910.

6. Four prospectors with only one lantern must walk through a mine shaft. At most, two prospectors can travel together and any prospector in the shaft must be with the lantern. The prospectors, named Andrews, Blake, Johnson, and Kelly, can walk through the shaft in one minute, two minutes, four minutes, and eight minutes, respectively. When two walk together they travel at the speed of the slower prospector. How can all four prospectors get through the mine shaft in only 15 minutes? After you have solved this problem, explain how you got your foot in the door.

7. Identify the body of the following loop struc- ture and count the number of times it will be executed. What happens if the test is changed to read "(Count != 6)"?

Count = 1

while (Count != 7):

  print(Count)

  Count = Count + 3

8. In what sense do the following three steps not constitute an algorithm?

Step 1: Draw a straight line segment between the points with rectangular coordinates (2,5) and (6,11).

Step 2: Draw a straight line segment between the points with rectangular coordinates (1,3) and (3,6).

Step 3: Draw a circle whose center is at the intersection of the previous line segments and whose radius is two

9. Rewrite the following program segment using a while structure rather than a repeat structure. Be sure the new version prints the same values as the original.

Count = 1

repeat:

print(Count)

Count = Count + 1

until (Count >= 7)

10. What is the difference between a formal programming language and a pseudocode?

11. What is the difference between syntax and semantics?

12. What letters are interrogated by the binary search (Figure 5.14) if it is applied to the list A, B, C, D, E, F, G, H, I, J, K, L, M, N, O when searching for the value J? What about search- ing for the value Z?

13. Write an algorithm to take a positive integer n as input and produce the sum of 1+2+..+n. Your algorithm must use while loop control

14. Writean algorithm to take a positive integer n as input and produce the sum of 1+2+..+n. Your algorithm must use recursive control

Reference no: EM131687849

Questions Cloud

Involve some form of organized crime : Why do computer-based crimes more likely involve some form of organized crime, rather than the actions of a single person?
Analyze the marketing strategies used by the company : In a PowerPoint presentation that you will show at the next corporate board meeting, analyze the marketing strategies used by the company.
Area of wireless networking and security : How will these trends affect the desktop and mobile operating systems mentioned in this course?
Discuss every cultivation is different and in some occasions : In every cultivation is different and in some occasions, work together for economic reasons and to be known around the people and other villages
Program represent an algorithm in the strict sense : Does the following program represent an algorithm in the strict sense? Why or why not?
How would start incident off correctly by securing evidence : You have been asked by management to secure the laptop computer of an individual who was just dismissed from the company under unfavorable circumstances.
Discuss narration who narrated the story : Narration Who narrated the story. Was it first-person narration or third-person narration. Was the narrator a reliable source of information
Display the vendorname and vendorstate : Display the VendorName and VendorState from the Vendor table for all vendors located in Florida, followed by those vendors located in Georgia using a SET.
Fnancial advantage for a malware designer : What would be the ?nancial advantage for a malware designer to create lots of different malicious code instances that all exploit the same vulnerability

Reviews

Write a Review

Business Management Questions & Answers

  Caselet on michael porter’s value chain management

The assignment in management is a two part assignment dealing 1.Theory of function of management. 2. Operations and Controlling.

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. Due to increase in the preference for light beer drinkers, Chris Prangel wants to introduce light beer version in Mountain Man. An analysis into the la..

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. An analysis into the launch of Mountain Man Light over the present Mountain Man Lager.

  Analysis of the case using the doing ethics technique

Analysis of the case using the Doing Ethics Technique (DET). Analysis of the ethical issue(s) from the perspective of an ICT professional, using the ACS Code of  Conduct and properly relating clauses from the ACS Code of Conduct to the ethical issue.

  Affiliations and partnerships

Affiliations and partnerships are frequently used to reach a larger local audience? Which options stand to avail for the Hotel manager and what problems do these pose.

  Innovation-friendly regulations

What influence (if any) can organizations exercise to encourage ‘innovation-friendly' regulations?

  Effect of regional and corporate cultural issues

Present your findings as a group powerpoint with an audio file. In addition individually write up your own conclusions as to the effects of regional cultural issues on the corporate organisational culture of this multinational company as it conducts ..

  Structure of business plan

This assignment shows a structure of business plan. The task is to write a business plane about a Diet Shop.

  Identify the purposes of different types of organisations

Identify the purposes of different types of organisations.

  Entrepreneur case study for analysis

Entrepreneur Case Study for Analysis. Analyze Robin Wolaner's suitability to be an entrepreneur

  Forecasting and business analysis

This problem requires you to apply your cross-sectional analysis skills to a real cross-sectional data set with the goal of answering a specific research question.

  Educational instructional leadership

Prepare a major handout on the key principles of instructional leadership

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd