Download HW 02

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
CmSc 250 Fundamentals of Computing III
Homework 02, due 09/11
The algorithm for generating consecutive primes not exceeding a given integer n was
probably invented in ancient Greece and is known as the sieve of Eratosthenes (ca. 200
B.C.)
1. Search for the algorithm on the Web (use the links provided on our class web
page). Find at least three descriptions of the algorithm.
2. Study the algorithm. Using the algorithm, find the primes from 1 to 20 to make
sure you have understood it.
3. Design appropriate data structures to implement the algorithm.
4. Describe the basic operations in the algorithm. These operations will be
implemented at some later time.
5. Write the algorithm in pseudocode using the designed data structures and the
basic operations (of course you will use also other operations , e.g. incrementing a
variable, however the pseudocode has to be built on the basic operations that you
have described in the previous task).
6. Trace the algorithm on paper for n = 20. Write down each step of the trace.
What to turn in:
1. Informal description of the algorithm
2. Description of the data structures
3. Description of the basic operations
4. Pseudocode
5. Tracing steps for n = 20
Please follow the instructions of homework submission
Don’t forget to write your name!
1