COP 3502 Recitation 2 THE SIEVE OF ERATOSTHENES

  • Slides: 28
Download presentation
COP 3502 Recitation 2 THE SIEVE OF ERATOSTHENES CUMULATIVE FREQUENCY

COP 3502 Recitation 2 THE SIEVE OF ERATOSTHENES CUMULATIVE FREQUENCY

Note to anybody seeing this These slides are slightly different from what was used

Note to anybody seeing this These slides are slightly different from what was used in the recitation to reflect the most accurate information

Answers to students’ questions Can I wait until the end of Week 4 to

Answers to students’ questions Can I wait until the end of Week 4 to submit the lab program for Week 1? Can I leave recitation early if I want to work on the program elsewhere? No Is there lab next week for Monday recitation people due to Labor day? No – If you choose to submit Week 1’s lab program, it’s due this Friday All labs next week are cancelled If I got the okay from Dr. ___ to attend a different lab section than the one I signed up for on my. UCF, what do I need to do? Just sign the attendance sheet for the lab section you’re attending

Answers to students’ questions Do I submit the lab program on webcourses? When is

Answers to students’ questions Do I submit the lab program on webcourses? When is it due? Can I use the is. Prime() function from C’s math library? No If I use an algorithm other than the Sieve of Eratosthenes, is that okay? Yes. Friday. Yes, but it might be too slow. Can I work on the lab program with a person in different lab section? No, only people in your same lab section. See Dr. Guha or Dr. Szumlanski if you want to change lab sections.

Announcements Lab programs located at http: //www. cs. ucf. edu/courses/cop 3502/fall 2015/lab/ Attend your

Announcements Lab programs located at http: //www. cs. ucf. edu/courses/cop 3502/fall 2015/lab/ Attend your assigned lab section Why? Keep lab sections balanced. Need professor’s approval to switch sections TA office hours have been published

Lab Program Details Work in pairs or individually – need laptop Exactly 2 programs

Lab Program Details Work in pairs or individually – need laptop Exactly 2 programs / semester If you submit this week’s program Due Put date: this Friday both partners’ names in header comment Submit separately

Lab Program – Prime Sums! Prime numbers: 2, 3, 5, 7, 11, 13, …

Lab Program – Prime Sums! Prime numbers: 2, 3, 5, 7, 11, 13, … n 1 2 3 P(n) 2 2+3=5 2 + 3 + 5 = 10 4 5 2 + 3 + 5 + 7 = 17 2 + 3 + 5 + 7 + 11 = 28

Review of malloc and free int num. Primes = 10000; int* my. Array =

Review of malloc and free int num. Primes = 10000; int* my. Array = malloc(sizeof(int) * num. Primes); … free(my. Array);

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Note: Code this up yourself. Don’t look it up.

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10

The Sieve of Eratosthenes 2 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11

The Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 5 6 7 8 9 10

The Sieve of Eratosthenes 2 3 4 5 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 5 6 7 8 9 10

The Sieve of Eratosthenes 2 3 4 5 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 5 6 7 8 9 10

The Sieve of Eratosthenes 2 3 4 5 5 6 7 8 9 10 11 12 13 14 15

The Sieve of Eratosthenes 2 3 4 5 5 6 7 7 8 9

The Sieve of Eratosthenes 2 3 4 5 5 6 7 7 8 9 10 11 12 13 14 15 11 13

Cumulative Frequencies Scores: 1, 1, 2, 2, 2, 3, 3, 4, 4, 5 Score

Cumulative Frequencies Scores: 1, 1, 2, 2, 2, 3, 3, 4, 4, 5 Score 1 2 3 Frequency 2 5 4 Cumulative Frequency 2 7 11 4 5 2 1 13 14 https: //www. mathsisfun. com/definitions/cumulative-frequency. html