concept invariant in category algorithms

appears as: invarits
Algorithms and Data Structures in Action

This is an excerpt from Manning's book Algorithms and Data Structures in Action.

  • Invariants: (optional) internal properties that are always hold true throughout the life of the data structure. For instance, a sorted list would have one invariant: every element is not greater than its successor. The purpose of invariants is making sure the conditions necessary to live up to the contract with the external clients are always met. They are the internal counterpart of the guarantees in the API.
  • #11 Finally, we reconnect y to the tree by setting it as x’s new right child.