Conversation
Dzhoker1
reviewed
Nov 8, 2018
| #cProfile.run('alex_function(1000)') 1 0.001 0.001 0.010 0.010 task_41.py:38(alex_function) | ||
|
|
||
| # ============================================================================= | ||
| # Вывод: alex_function - WIN! Сложность практически линейная. |
|
|
||
|
|
||
|
|
||
| def my_simple_numbers(n): #Максимально бессмысленный и беспощадный вариант |
| #100 loops, best of 3: 1.38 msec per loop | ||
|
|
||
|
|
||
| def clear_simple_numbers(n): #Банально брал верхнюю границу по известным простым числам. |
There was a problem hiding this comment.
1-е и 2-е простые числа вообще не ищет. А 3-е оказывается 2. Странно, всегда думал, что 5. Да и вариант выше со мной согласен.
| #100 loops, best of 3: 123 usec per loop | ||
|
|
||
|
|
||
| def full_eratosthenes(n): # Так и не понял, как определить верхнюю границу |
There was a problem hiding this comment.
Тут ситуация лучше. Ищет простые числа верно, кроме 1-го.
| #cProfile.run('full_eratosthenes(30)') 1 0.000 0.000 0.001 0.001 task_42.py:53(full_eratosthenes) | ||
|
|
||
| # ============================================================================= | ||
| #Вывод: |
There was a problem hiding this comment.
Вариант 2 нельзя сравнивать с 1 и 3 по асимптотике, т.к. он изначально работает неправильно.
В остальном всё верно
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.