How many times each square was landed on

Assignment Help Basic Computer Science
Reference no: EM131302270

Extend the random walk program from Chapter 9 (Programming Exercise 12) to keep track of how many times each square of the sidewalk is crossed. Start your walker in the middle of a sidewalk of length n where n is a user input, and continue the simulation until it drops off one of the ends. Then print out the counts of how many times each square was landed on.

Exercise 12:

A random walk is a particular kind of probabilistic simulation that models certain statistical systems such as the Brownian motion of molecules. You can think of a one-dimensional random walk in terms of coin flipping. Suppose you are standing on a very long straight sidewalk that extends both in front of and behind you. You flip a coin. If it comes up heads, you take a step forward; tails means to take a step backward.

Suppose you take a random walk of n steps. On average, how many steps away from the starting point will you end up? Write a program to help you investigate this question.

Reference no: EM131302270

Questions Cloud

What is the cost of preferred stock : Holdup Bank has an issue of preferred stock with a $4.45 stated dividend that just sold for $81 per share. What is the bank's cost of preferred stock?
Find volume enclosed by surface using monte carlo simulation : A three-dimensional surface is defined.- How many points did you need to generate before you became 90% confident that your error was less than 1%?
Examine the theoretical framework : In an analysis of 750-900 words, examine the theoretical framework, style, and leadership traits presented in the story. Discuss how this particular individual has adopted leadership as a vocation. As a leader, which qualities of this person would..
What is the companys cost of equity : The Absolute Zero Co. just issued a dividend of $3 40 per share on its common stock The company is expected to maintain a constant 7 percent growth rate in its dividends indefinitely. If the stock sells for $68 a share, what is the company's cost of ..
How many times each square was landed on : Suppose you take a random walk of n steps. On average, how many steps away from the starting point will you end up? Write a program to help you investigate this question.
What privacy issues are hindering the adoption of emr system : What are the physical locations where workstations, printers, servers, and other hardware will be installed? How will you provide users enough information about the system being installed to gain their confidence?
Define encapsulation polymorphism and inheritance : Modify the Dice Poker program from this chapter to include any or all of the following features:
What transaction should you do : You hold a stock portfolio worth $15 million with a beta of 1.05. You would like to lower the beta to 0.90 using S&P 500 futures, which have a price of 460.20 and a multiplier of 250. What transaction should you do?
Alternative and recommend least costly option rent or buy : You are currently renting an apartment for $725 per month and paying $275 annually for renter’s insurance. You just found a small townhouse you can buy for $185,000. You have enough cash for a $10,000 down payment and $4,000 in closing costs. calcula..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  What are the risks to the organization

The Chief Security Officer has asked you to stop allowing error reply messages to leave the internal internets. Why is she asking you to perform this action? What are the risks to the organization if this is not done?

  Computer security is not an issue for organizations alone

Computer security is not an issue for organizations alone. Anyone whose personal computer is connected to a network or the Internet faces a potential risk of attack.

  Key steps involved in project management

Using the Internet, the library, and any other resources you like conduct research on the project management process, including information such as:

  Earmarks in legislation or pharmaceutical salespersons

In 100 word, discuss bribery. Would actions, such as politicians adding earmarks in legislation or pharmaceutical salespersons giving away drugs to physicians, constitute bribery? Identify three business activities that would constitute bribery an..

  Two different types of attacks

Explain the two different types of attacks that can be performed in Cain and Abel to crack user accounts passwords. Which do you think is most effective, and why?

  Construct an algorithm that suitably modifies x

Construct an algorithm that suitably modifies x to obtain a basic feasible flow vector and an associated spanning tree

  Filing and property taxes

Income taxes for the three years prior to filing and property taxes for the prior year. Money obtained fraudulently

  Javascript techniques to improve usability

Design a suitable applied web form example which has a work context. The form that needs to be created is a contact form for a Student Forum. Design the form which must have user input and a range of form furniture Ie. Buttons/ user Input fields. ..

  How would their limits be set

How would their limits be set?

  Which sources of growth are most likely to be protrade

Which sources of growth are most likely to be antitrade? Which types of commodities are most likely to result in protrade consumption? antitrade consumption?

  Change the number of parameters an operator takes

"You cannot change the number of parameters an operator takes." What does this really mean and what are implications of this when you use polymorphism in your programs? Try to provide specific examples and 600 words.

  Determine a regular language

Exhibit an algorithm for determining whether or not a regular language L contains any string w such that wr ? L.

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