-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E_Maksimova_lesson_04 #1258
base: master
Are you sure you want to change the base?
E_Maksimova_lesson_04 #1258
Conversation
|
||
print(f"Время выполнения: {timeit('func_2(test_list)', number=100000, globals=globals())}") # ~ 0.43 | ||
|
||
# Замеры показывают, что вторая функция действительно работает быстрее. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
выполнено
# имеет факториальную сложность. | ||
# Например, можно написать функцию, которая будет преобразовывать введённое число в строку и | ||
# использовать реверс среза: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучшее выполнение за все время ведения курса
# использует встроенную функцию str и встроенный функционал срезов, реализованные наиболее оптимальным образом. | ||
# Кроме того, третья функция не тратит время на множество промежуточных вычислений и переприсваиваний, | ||
# в отличие от функции с циклом. Рекурсивная же функция работает медленнее всего по определению - из-за | ||
# сложности рекурсивного алгоритма. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
выполнено
return f'Чаще всего встречается число {max_elem}, ' \ | ||
f'оно появилось в массиве {result[max_elem]} раз(а)' | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
отлично
# Сложность наивного и улучшенного наивного алгоритмов близка к квадратичной, но скорость работы улучшенного | ||
# наивного алгоритма растёт гораздо медленнее и при малом значении i он будет быстрее, чем алгоритм с решетом, | ||
# однако уже при i = 100 решето становится эффективнее. | ||
# Сложность алгоритма решето Эратосфена O(n log(log n)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
выполнено
4 урок, Алгоритмы и структуры данных, старт 09.03.2021, Максимова Елена