Skip to content

pos [terminology]

Terminology

Usage

  • Use for a mapping from values or objects to their positions.
  • It distinguishes an index lookup table from a single index.
  • Prefer pos over idx for dictionaries that answer “where is this value?”
pos = {val: i for i, val in enumerate(inorder)}
mid = pos[root_val]