Conversation
priority_queue.py
Outdated
There was a problem hiding this comment.
Try to name your functions with a verb (because the function does some action). In this case, you could call your up function as swim, bubble_up, etc. Avoid such namings as up / upwards etc.
priority_queue.py
Outdated
There was a problem hiding this comment.
What is int((index - 1) / 2 in your function? You've already used it twice here, so consider saving this expression to a variable with readable naming that explains the purpose of this expression.
priority_queue.py
Outdated
There was a problem hiding this comment.
Why do you wrap index with int? It's already int.
There was a problem hiding this comment.
Sometimes indexes is float. For example: when index is 2, 2 - 1 is 1, 1 / 2 is 0,5. Indexes must be int, not float. int() function returns a number rounded + converts it to int.
There was a problem hiding this comment.
Better implemented now.
priority_queue.py
Outdated
There was a problem hiding this comment.
Why did you write these operations separately? It's actually index = (index - 1) / 2 (you have used it already). So what this expression means?
priority_queue.py
Outdated
There was a problem hiding this comment.
Again. Name your functions with a verb. In this case, you could name your down function as sink, bubble_down, etc.
No description provided.