Skip to content

Main content

List: List Equal Key Stability Pair Tool

Check whether an explicit output-ordered pair preserves original order for equal numeric keys, without sorting or claiming whole-list stability.

Loading tool…

Description

equalKeys compares the keys; stableIfInThisOrder is true for unequal keys or increasing original indices.

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.

equalKeys compares the keys; stableIfInThisOrder is true for unequal keys or increasing original indices.

When to use this tool

Use List: List Equal Key Stability Pair when you need one explicit key comparison or stability condition.

How to use the tool and how it works

  1. Enter firstKey, secondKey, firstOriginalIndex, secondOriginalIndex. 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.

Require distinct original indices. equalKeys compares the keys; stableIfInThisOrder is true for unequal keys or increasing original indices.1

Input fieldMeaning and unitsAccepted input
firstKeyFirst KeyRequired. Finite number.
secondKeySecond KeyRequired. Finite number.
firstOriginalIndexFirst Original IndexRequired. Safe integer.
secondOriginalIndexSecond Original IndexRequired. Safe integer.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.equalKeysEqual KeysCalculated result member: boolean.
result.stableIfInThisOrderStable If In This OrderCalculated result member: boolean.
json
{
  "input": {
    "firstKey": 2,
    "secondKey": 2,
    "firstOriginalIndex": 5,
    "secondOriginalIndex": 3
  },
  "output": {
    "result": {
      "equalKeys": true,
      "stableIfInThisOrder": false
    }
  }
}

Limitations and assumptions

  • This assesses stability for a pair, not whether unequal keys are sorted or a complete ordering is valid.
  • 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-equal-key-stability-pair — tool.io

Similar or alternative tools