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
container/heap: avoid use of the term "heap invariants" #65492
Comments
The first part of the package documentation says:
So how about we document Init thus:
and replace "heap invariants" with "heap property" throughout? Feel free to send a CL. |
Thanks for chiming in, @adonovan ! I have slightly adapted your suggestion and created a PR. I have excluded the mention of a "sequence", since it is my understanding that a heap could be implemented with, e.g., a tree data structure, which is (to my knowledge) not considered a sequence. Even though it might just be a small improvement, I feel like "heap property" will be more commonly understood than "heap invariants". Mentioning that the |
Change https://go.dev/cl/562295 mentions this issue: |
I really think "heap invariant" is fine. |
I'm fine with either, but Ian is usually right. "Invariant" is an important word to know, and if you learned it from this package, maybe that's no bad thing. Sorry for the churn. |
Alright; no hard feelings. Maybe the term is more commonly known than I'm aware and it was just a personal gap in education. |
Go version
go version go1.21.1 openbsd/amd64
Issue
In the documentation of the
Init
function as well as theInterface
interface and within the PriorityQueue example the term "heap invariants" is used. Maybe it is because I lack the academic background, but the term confused me when trying to understand the purpose of theInit
function.After some further reading I now understand, that it basically just means that the
Init
function establishes a correctly "sorted" heap from an "unsorted" input. I assume, that "sorting" is not the correct term to use and "establishing invariants" is a formally correct way to describe whatInit
does. However, I feel like easier language could be used to describe the function ofInit
and thus ease the understanding of the package.The text was updated successfully, but these errors were encountered: