Details of this Paper

Use an array of 10,000 Boolean values to represent the list of numbers. Initialize all the array elements to true....

Description

solution


Question

Use an array of 10,000 Boolean values to represent the list of numbers. Initialize all the array elements to true. To ?mark out? a number, reset the corresponding array element to false.;You should write these functions and include them in your program;void initialize(bool primeList[]);void markOutComposites(bool primeList[]);void outputPrimes(ofstream &outFile, bool primeList[]);The Sieve of Eratosthenes can be implemented with a simple, ?brute force? algorithm that works correctly but is very slow due to a lot of unnecessary ?marking out? of values that have already been marked out. With some careful, clever thought and clever coding, you can reduce the redundancy to make your program much faster.

 

Paper#71289 | Written in 18-Jul-2015

Price : $22
SiteLock