Skip to content

Main content

List: List Insertion Side Tie Policy Tool

Resolve one sorted ascending insertion comparison with an explicit before/after equal-key policy, not a sorting algorithm.

Loading tool…

Description

Insert before when incomingKey is smaller, or when keys are equal and equalPolicy is before.

Ordering and stability are different properties. A stable operation preserves original order among equal keys, while an insertion policy determines which side of an existing equal key receives a new item.

Insert before when incomingKey is smaller, or when keys are equal and equalPolicy is before.

When to use this tool

Use List: List Insertion Side Tie Policy when you need one explicit key comparison or stability condition.

How to use the tool and how it works

  1. Enter existingKey, incomingKey, equalPolicy. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Insert before when incomingKey is smaller, or when keys are equal and equalPolicy is before. Report equal independently.1

Input fieldMeaning and unitsAccepted input
existingKeyExisting KeyRequired. Finite number.
incomingKeyIncoming KeyRequired. Finite number.
equalPolicyEqual PolicyRequired. Text; one of "before", "after". Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.insertBeforeInsert BeforeCalculated result member: boolean.
result.equalEqualCalculated result member: boolean.
json
{
  "input": {
    "existingKey": 2,
    "incomingKey": 2,
    "equalPolicy": "after"
  },
  "output": {
    "result": {
      "insertBefore": false,
      "equal": true
    }
  }
}

Limitations and assumptions

  • This compares one pair only; it does not locate an insertion point or sort a list.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Check the complete comparator and ordering rule when sorting or inserting an actual collection.

References

  1. Calculation and input contract: list/list-insertion-side-tie-policy — tool.io

Similar or alternative tools