lab2 - CSS 342: Mathematical Principles of Computing Lab 2:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSS 342: Mathematical Principles of Computing Lab 2: Algorithm Analysis Professor: Munehiro Fukuda Assigned: See Our Syllabus Purpose This programming assignment empirically analyzes the running time of the Sieve of Eratosthenes. You will code this program, plot its running time, and compare it with O(N log log N) . The Sieve of Eratosthenes Read your textbook p228. Statement of Work This is a group work. Form a group of two students. (If you can't find a partner, you may form a group of three.) 1. Write a program that reads the integer n and finds all primes in the range 2 to n . Your program prints out the running cost, (i.e., the number of array-sweeping operations required to find all those primes). To verify the correctness of your program, you should handle a printing option given from the standard input, as shown below: char printOption = 'n'; cout << "print all primes (y|n)? "; cin >> printOption; if ( printOption == 'y' ) { // print all primes } If this option has been set, your program should print out all primes in the range 2 to
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

lab2 - CSS 342: Mathematical Principles of Computing Lab 2:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online