What is an invariant?
An invariant is more “conceptual” than a variable. In general, it’s a property of the program state that is always true. A function or method that ensures that the invariant holds is said to maintain the invariant. For instance, a binary search tree might have the invariant that for every node, the key of the … Read more