Professional Documents
Culture Documents
Class Lecture-2.1
Question:
a)17 % 7 = ?
b)-17%7 =?
08/15/20 2
Prime Number
08/15/20 3
Trial and Error Method
Question : Is 9 prime ?
2 3 4 5 6 7 8 9
9%2 9%3
08/15/20 4
Trial and Error Method
Question : Is 11 prime ?
2 3 4 5 6 7 8 9 10
11 % 2 11 % 3 11 % 4 11 % 5 11 % 6 11 % 7 11 % 8 11 % 9 11%10
08/15/20 5
The Sieve of Eratosthenes
• We need to generate prime numbers upto 30.
• Square Root of √30 = 5.48
08/15/20 6
The Sieve of Eratosthenes
08/15/20 7
The Sieve of Eratosthenes
08/15/20 8
The Sieve of Eratosthenes
08/15/20 9
Growth of function
Big-Oh: gives an upper bound on the growth
rate of a function.
Insertion sort is O(n2) in the worst case
This means that in the worst case it performs at most
c.n2 operations, where c is constant.
Omega: asymptotic lower bound.
Theta: asymptotic tight bound
08/15/20 10
Thank You
11