Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all methods of MinMaxHeap which accept indices assert that indices are in the bounds #58

Closed
nbro opened this issue Mar 12, 2017 · 1 comment

Comments

@nbro
Copy link
Owner

nbro commented Mar 12, 2017

For consistency, I should assert in all methods that accept "indices" that they are valid, i.e. by using something of the form assert self.is_good_index(my_index). Examples of functions that do not do that: _index_of_max, _index_of_min, etc.

Mare sure that this assertion is required in certain methods: it may happen that it's "ok" that in a call or recursive sub-call to a function the indices are no more valid!!!

Check also the cases for BinaryHeap, MinHeap and MaxHeap.

@nbro
Copy link
Owner Author

nbro commented Mar 14, 2017

False positive: those functions are already checking their indices when they call other functions at the beginning of their body which actually explicitly call assert self.is_good_index(my_index).

@nbro nbro closed this as completed Mar 14, 2017
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

No branches or pull requests

1 participant