ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 27 May 2017 My Price 8.00

Submit PrimeQueue.java

Textbook Programming Project #1, page 905:  Submit PrimeQueue.java

Read description in the text, and study the pseudo-code provided (also on Wikipedia (Links to an external site.)).  Then create a class named PrimeQueue.java that contains a public static method getPrimes(n), which returns a Queue of prime numbers up to n.  I will test these programs with a simple test like:

Queue<Integer> q = PrimeQueue.getPrimes(12345);

Please remove (or comment out) your System.out calls, as my testing will be external.  Also be aware of the Big-O of your algorithm, as nesting loops too deep here will really slow down the algorithm and be very apparent upon testing.  Above example finds 1474 prime numbers and runs fast no matter how it's coded.  Bump that up to getPrimes(12345678) so there are 800k+ primes and it still should be able to find that in a couple seconds.

NOTE:  The pseudo code in text indicates two Queues (numbers and result).  If you use an array like a Queue for the numbers start, and kind of follow the Wikipedia example, and build the Queue on the final step, then the total process time can be much faster.

Attachments:

Answers

(11)
Status NEW Posted 27 May 2017 03:05 AM My Price 8.00

-----------

Not Rated(0)