Skip to content

Контрольная работа#11

Open
sugahu565 wants to merge 2 commits intorufffrom
priorityQueue
Open

Контрольная работа#11
sugahu565 wants to merge 2 commits intorufffrom
priorityQueue

Conversation

@sugahu565
Copy link
Owner

Тестов нет, так как не смогла задебажить фукнцию merge и она работает некорректно (скорее всего, как и exctract_min, так как не было возможности её проверить)

@sugahu565 sugahu565 changed the base branch from CI to ruff December 12, 2025 14:29
Copy link

@Godrik0 Godrik0 left a comment

Choose a reason for hiding this comment

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

  • -8 баллов за merge
  • -8 баллов за extract_min
  • -4 балла за insert
    Итого 10/30

self.head = None


def merge(self, h1, h2):
Copy link

Choose a reason for hiding this comment

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

merge должен принимать 2 аргумента, self и other_heap, либо же делать метод статическим и принимать h1, h2

Comment on lines +46 to +49
while cur_h.sibling is not None:
if cur_h.deg != cur_h.sibling.deg:
tmp = cur_h.sibling
cur_h.sibling = cur_h.sibling.child
Copy link

Choose a reason for hiding this comment

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

Кажется вот тут неправильно сделано

curxBefore = None
xBefore = None
while curx is not None:
if curx.key < mn:
Copy link

Choose a reason for hiding this comment

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

В текущем виде получаются такие сравнения 5 < -1e9


def insert(self, value):
new_h = PriorityQueue()
new_h.head = Vertex(1, value, None, None)
Copy link

Choose a reason for hiding this comment

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

У одиночной вершины степень 0, а не 1

Comment on lines +82 to +83
while curx is not None:
curx = curx.sibling
Copy link

Choose a reason for hiding this comment

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

Тут должен был быть разворот списка детей

xBefore.sibling = x.sibling
h_new = None
curx = x.child
h_new.head = x.child
Copy link

Choose a reason for hiding this comment

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

h_new сейчас None

Comment on lines +88 to +90
def delete(self, h):
while self.head is not None:
self.exctract_min(h)
Copy link

Choose a reason for hiding this comment

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

Обычно в delete мы хотим удалить конкретную вершину, сейчас у вас скорее clear

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