Skip to content

Conversation

InbarAbraham
Copy link

Updated the peek method to check if the heap contains at least one element before accessing self.heap[1].
This prevents a potential IndexError when the heap is empty.

Updated the `peek` method to check if the heap contains at least one element before accessing `self.heap[1]`. This prevents a potential IndexError when the heap is empty.
Fix peek method to prevent IndexError
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.

1 participant