sieve of eratosthenes

PPTX 21 стр. 290,3 КБ Бесплатная загрузка

Предварительный просмотр (5 стр.)

Прокрутите вниз 👇
1 / 21
sieve of eratosthenes sieve of eratosthenes algorithms and data structures course sieve of eratosthenes need to find all primes from 1 to n. prime numbers is a numbers that have 2 distinct divisors, 1 and themselves. let’s take a look, how we can check number primeness: if there is no divisor from 2 to square root of our number, then our number is prime: algorithms and data structures course sieve of eratosthenes need to find all primes from 1 to n. each number we can check in o( time. for checking all numbers from 1 to n we will need time. we can compute faster. algorithms and data structures course sieve of eratosthenes let’s create a table with all numbers from 1 to 100 (n = 100, for example): algorithms and data structures course 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 …
2 / 21
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 sieve of eratosthenes and mark all numbers that dividing by 2: algorithms and data structures course 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 …
3 / 21
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 sieve of eratosthenes and again for 7: algorithms and data structures course 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 …
4 / 21
e: algorithms and data structures course sieve of eratosthenes second optimization obviously, to find all the prime numbers until n, it will be enough just to perform the sifting only by the prime numbers, which do not exceed the root of n. optimized code: algorithms and data structures course sieve of eratosthenes third optimization since all even numbers (except 2) are composite, we can stop checking even numbers at all. instead, we need to operate with odd numbers only. it will reduce the number of operations performing by algorithm approximately in half. optimized code: algorithms and data structures course sieve of eratosthenes optimizations and complexity there are several additional optimizations: half the needed memory by removing unnecessary memory for even number. reducing consuming memory using bit-level compression. and some other. complexity of sieve is . there is a complex evidence of it, and it is hard to prove. you can …
5 / 21
sieve of eratosthenes - Page 5

Хотите читать дальше?

Скачайте все 21 страниц бесплатно через Telegram.

Скачать полный файл

О "sieve of eratosthenes"

sieve of eratosthenes sieve of eratosthenes algorithms and data structures course sieve of eratosthenes need to find all primes from 1 to n. prime numbers is a numbers that have 2 distinct divisors, 1 and themselves. let’s take a look, how we can check number primeness: if there is no divisor from 2 to square root of our number, then our number is prime: algorithms and data structures course sieve of eratosthenes need to find all primes from 1 to n. each number we can check in o( time. for checking all numbers from 1 to n we will need time. we can compute faster. algorithms and data structures course sieve of eratosthenes let’s create a table with all numbers …

Этот файл содержит 21 стр. в формате PPTX (290,3 КБ). Чтобы скачать "sieve of eratosthenes", нажмите кнопку Telegram слева.

Теги: sieve of eratosthenes PPTX 21 стр. Бесплатная загрузка Telegram