Skip to content

homework to lesson 7#10

Open
zagidulin wants to merge 1 commit intomasterfrom
lesson_7
Open

homework to lesson 7#10
zagidulin wants to merge 1 commit intomasterfrom
lesson_7

Conversation

@zagidulin
Copy link
Copy Markdown
Owner

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 les_7_task_1.py
# Идея улучшения в том, что число "всплывает" минуя сразу несколько больших (меньших) элементов
# без лишних перестановок и не проверяются те элементы, которые уже заняли свои места в конце списка.

def bubbles(array):
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 les_7_task_2.py
while len(left_eggs) > 0 and len(right_eggs) > 0:
if left_eggs[0] < right_eggs[0]:
sorted_list.append(left_eggs[0])
left_eggs.pop(0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pop(0) - тянет на двойку после всего того, что мы знаем о списках и асимптотике.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Надо пересмотреть точно... В памяти осталось будто pop() быстрый) Информационное переедание, видимо

Comment thread les_7_task_3.py
m = int(input('Введите натуральное число: '))
array = [random.randint(MIN, MAX) for i in range(2*m + 1)]

def mediana(array):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Интересная реализация. Класс!

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