Skip to content

040_lesson#4

Open
ikrugloff wants to merge 1 commit into
masterfrom
040_lesson
Open

040_lesson#4
ikrugloff wants to merge 1 commit into
masterfrom
040_lesson

Conversation

@ikrugloff
Copy link
Copy Markdown
Owner

Profiling (computer programming)

Profiling ex.
Copy link
Copy Markdown

@Dzhoker1 Dzhoker1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Оставил комментарии по коду

Comment thread alg_ex_1.py
@@ -0,0 +1,34 @@
# Алгоритм Евклида. Нахождение "Наибольшего Общего Делителя (НОД)"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На дом такую задачу я не задавал. Почему вы решили взять её. Но всё равно дочитаю до конца.

Comment thread alg_ex_2.py
@@ -0,0 +1,75 @@
import math

# Решето Эратосфена
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Решето Эратосфена из урока. Хорошо. Но ответ про i-е простое число функция не выдаёт.

Comment thread alg_ex_2.py

# Решето Аткина

def Atkin(nmax):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ещё одно решето. Класс. И работает. Но проблема та же. Прошу сказать мне 5-е простое число и вместо 11 получаю список [2, 3, 5].

@@ -0,0 +1,6 @@
Tue Sep 4 02:19:57 2018
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Представляю как у вас кипела работа ночью )))

print(f'{time.ctime(time.time())}\n')

# Рекурсивная реализация алгоритма Евклида. --> GCD1 (n * e-06 = n / 10 ^ 6)
start1 = time.time()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Знакомый вариант для замера времени )))


print(f'{time.ctime(time.time())}\n')

# С модулем timeit расчет времени работы алгоритма идёт очень медленно!!!
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ещё бы. Ведь модуль запускает алгоритм 1000000 раз.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants