Skip to content

lesson-4#4

Open
serg0761 wants to merge 1 commit into
lesson-1from
lesson-4
Open

lesson-4#4
serg0761 wants to merge 1 commit into
lesson-1from
lesson-4

Conversation

@serg0761
Copy link
Copy Markdown
Owner

@serg0761 serg0761 commented Nov 7, 2018

No description provided.

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 task_41.py
#cProfile.run('alex_function(1000)') 1 0.001 0.001 0.010 0.010 task_41.py:38(alex_function)

# =============================================================================
# Вывод: alex_function - WIN! Сложность практически линейная.
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 task_42.py



def my_simple_numbers(n): #Максимально бессмысленный и беспощадный вариант
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 task_42.py
#100 loops, best of 3: 1.38 msec per loop


def clear_simple_numbers(n): #Банально брал верхнюю границу по известным простым числам.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1-е и 2-е простые числа вообще не ищет. А 3-е оказывается 2. Странно, всегда думал, что 5. Да и вариант выше со мной согласен.

Comment thread task_42.py
#100 loops, best of 3: 123 usec per loop


def full_eratosthenes(n): # Так и не понял, как определить верхнюю границу
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тут ситуация лучше. Ищет простые числа верно, кроме 1-го.

Comment thread task_42.py
#cProfile.run('full_eratosthenes(30)') 1 0.000 0.000 0.001 0.001 task_42.py:53(full_eratosthenes)

# =============================================================================
#Вывод:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Вариант 2 нельзя сравнивать с 1 и 3 по асимптотике, т.к. он изначально работает неправильно.
В остальном всё верно

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