Patterns built around maintaining ordered stacks and deques.