/
COP 3502 Recitation 2 The sieve of Eratosthenes COP 3502 Recitation 2 The sieve of Eratosthenes

COP 3502 Recitation 2 The sieve of Eratosthenes - PowerPoint Presentation

acenum
acenum . @acenum
Follow
361 views
Uploaded On 2020-07-03

COP 3502 Recitation 2 The sieve of Eratosthenes - PPT Presentation

Cumulative Frequency 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 ID: 794051

eratosthenes sieve program lab sieve eratosthenes lab program week submit section frequency cumulative due recitation sections work friday people

Share:

Link:

Embed:

Download Presentation from below link

Download The PPT/PDF document "COP 3502 Recitation 2 The sieve of Erato..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

COP 3502 Recitation 2

The sieve of Eratosthenes

Cumulative Frequency

Slide2

Note to anybody seeing this

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

Slide3

Answers to students’ questions

Can I wait until the end of Week 4 to submit the lab program for Week 1?

No – If you choose to submit Week 1’s lab program, it’s due this Friday

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?

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

myUCF

, what do I need to do?

Just sign the attendance sheet for the lab section you’re attending

Slide4

Answers to students’ questions

Do I submit the lab program on

webcourses

? When is it due?

Yes. Friday.

Can I use the

isPrime

() function from C’s math library?

No

If I use an algorithm other than the Sieve of Eratosthenes, is that okay?

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.

Slide5

Announcements

Lab

programs

located at http

://www.cs.ucf.edu/courses/cop3502/fall2015/lab

/

Attend your assigned lab section

Why? Keep lab sections balanced.

Need professor’s approval to switch sections

TA office hours have been published

Slide6

Lab Program Details

Work in pairs or individually – need laptop

Exactly 2 programs / semester

If you submit this week’s program

Due date: this Friday

Put both partners’ names in header comment

Submit separately

Slide7

Lab Program – Prime Sums!

Prime numbers: 2, 3, 5, 7, 11, 13, …

n

P(n)

1

2

2

2 + 3 = 5

3

2

+ 3 + 5 = 10

4

2 + 3 + 5 + 7 = 17

5

2 + 3 + 5 + 7 +

11 = 28

Slide8

Review of malloc

and free

int

numPrimes

= 10000;

i

nt

*

myArray

=

malloc

(

sizeof

(

int

) *

numPrimes

);

free(

myArray

);

Slide9

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.

Slide10

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

Slide11

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

Slide12

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

Slide13

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

Slide14

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

Slide15

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

Slide16

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

Slide17

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

Slide18

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

Slide19

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

Slide20

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

Slide21

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

Slide22

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

Slide23

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

5

Slide24

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

5

Slide25

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

5

Slide26

The Sieve of Eratosthenes

2

3

4

5

6

7

8

9

10

11

12

13

14

15

2

3

5

7

11

13

Slide27

Cumulative Frequencies

Scores: 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5

Score

Frequency

Cumulative Frequency

1

2

2

2

5

7

3

4

11

4

2

13

5

1

14

https://www.mathsisfun.com/definitions/cumulative-frequency.html

Slide28