Program for the peter-the-postman problem

Assignment Help Basic Computer Science
Reference no: EM131788464

Write a program for the Peter-the-postman problem in Problem 3, but use a dynamically allocated array

A prime number is an integer greater than 1 whose only positive divisors are 1 and the integer itself. The Greek mathematician Eratosthenes developed an algorithm, known as the Sieve of Eratosthenes, for finding all prime numbers less than or equal to a given number n-that is, all primes in the range 2 through n. Consider the list of numbers from 2 through n. Two is the first prime number, but the multiples of 2 (4,6,8, ...) are not, and so they are crossed out in the list. The first number after 2 that was not crossed out is 3, the next prime. We then cross out from the list all higher multiples of 3 (6,9,12, ...). The next number not crossed out is 5, the next prime, and so we cross out all higher multiples of 5 (10, 15,20, ...). We repeat this procedure until we reach the first number in the list that has not been crossed out and whose square is greater than n. All the numbers that remain in the list are the primes from 2 through n. Write a program that uses this sieve method and an array to find all the prime numbers from 2 through n. Execute the program for n =550 and for n =5500.

Reference no: EM131788464

Questions Cloud

Discuss the company attempt to sell in new york-new jersey : Which products should the company attempt to sell in New York-New Jersey
Pick out the projects that the firm should accept : The Suboptimal Glass Company uses a process of capital rationing in its decision making. The firm's cost of capital is 13 percent.
Program for the grading-on-the-curve problem : Write a program for the grading-on-the-curve problem in Problem 2, but use a dynamically allocated array.
Report the regression equation for predicting the years : Find and report the regression equation for predicting the mother's years of education from the father's.
Program for the peter-the-postman problem : Write a program for the Peter-the-postman problem in Problem 3, but use a dynamically allocated array
Prime-number-finder problem : Write a program for the prime-number-finder problem in, but use a dynamically allocated array.
Cartesian product table contain : The first table contains five rows and the second table contains three rows. How many rows will the Cartesian product table contain?
What is the sensitivity of ocf to changes in the variable : What is the sensitivity of OCF to changes in the variable cost figure. A negative amount should be indicated by a minus sign
Determine the net present value of the project : Draw a net present value profile for the investment and observe the discount rate at which the net present value is zero.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Choose two of the sorting algorithms

Question 1: Choose two of the sorting algorithms and discuss how they work. Ex: (Bubble Sort, Merge Sort)

  Find a function in x that gives the yield of apples

find a function in x that gives the yield of apples.

  Create presentation on template on office com

Watch the slide show in Slide Show view. Note that you do not need to manually advance the slide show until most of the slides have played. Note the five rules as they are presented so that you can list them later.

  Write a regular expression

Write a regular expression that matches a date in the usual format:   mm/dd/yy

  How do administrative controls demonstrate due care

How do Administrative Controls demonstrate "due care?" How does the absence of Administrative Controls impact corporate liability?

  Making process in different buying situations

Analyse the consumer buying decision making process in different buying situations relating to their involvement in the purchase and their perceived differences among brands.

  Market structure-pricing power

What can be learned from the Epipen controversy on value pricing, market structure, pricing power?

  Obtain formulas for estimating the variance components

Obtain formulas for estimating the variance components

  Describe various types of desktop

A good report of the process should include the following: 1) Describe various types of desktop you came across and recommend the chosen with its attributes, characters and qualities. 2) Classify the search engines you gathered information's. Point t..

  Perform a baseline study for pbsc

Assignment: Perform a baseline study for PBSC (palm beach state college) network (need to make assumptions). Create a list of all network devices (servers, routers, bridges, hubs, and so on... keep in mind that there are five campuses). What protocol..

  Can this deadlock be resolved by priority inheritance

Assume that the task set of Figure 11.5 is executed without the priority ceiling protocol. At what moment will a deadlock occur? Can this deadlock be resolved by priority inheritance?

  Calculate the minimum repeater height

Calculate the minimum repeater height and transmitted EIRP for a repeater that must communicate with mobile stations over a 50 km radius, maintaining a minimum field strength of 50 mV/m at the mobile receiver, which has an antenna height of 1.5 m...

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