{
  "id": "enwiki-001376833342",
  "slug": "adaptive-sort",
  "title": "Adaptive sort",
  "qid": "",
  "lead": "A sorting algorithm falls into the adaptive sort family if it takes advantage of existing order in its input. It benefits from the presortedness in the input sequence – or a limited amount of disorder for various definitions of measures of disorder – and sorts faster. Adaptive sorting is usually performed by modifying existing sorting algorithms.",
  "body": "A sorting algorithm falls into the adaptive sort family if it takes advantage of existing order in its input. It benefits from the presortedness in the input sequence – or a limited amount of disorder for various definitions of measures of disorder – and sorts faster. Adaptive sorting is usually performed by modifying existing sorting algorithms. for j = 1 to length(X) - 1 do t ← X[j] i ← j while i > 0 and X[i - 1] > t do X[i] ← X[i - 1] i ← i - 1 end X[i] ← t end The performance of this algorithm can be described in terms of the number of inversions in the input, and then will be roughly equal to , where is the number of inversions. Using this measure of presortedness – being relative to the number of inversions – insertion sort takes less time to sort the closer the array of data is to being sorted. Other examples of adaptive sorting algorithms are adaptive heap sort, adaptive merge sort, patience sort, Shellsort, smoothsort, splaysort, Timsort, and Cartesian tree sorting.",
  "categories": [
    "23118434",
    "23603337",
    "27152323"
  ],
  "license": "CC BY-SA 4.0",
  "source_uri": "https://en.wikipedia.org/w/index.php?oldid=1376833342",
  "content_hash": "",
  "created_at": null,
  "updated_at": 1790425523.0,
  "claims": [],
  "contradictions": [],
  "confidence": 0.6,
  "csl": {
    "id": "enwiki-001376833342",
    "type": "webpage",
    "title": "Adaptive sort",
    "author": [
      {
        "family": "Anticloud FZ LLE",
        "literal": "Anticloud FZ LLE"
      }
    ],
    "container-title": "encyclopegia.org",
    "publisher": "Anticloud FZ LLE",
    "publisher-place": "Dubai, United Arab Emirates",
    "URL": "https://encyclopegia.org/a/adaptive-sort",
    "issued": {
      "date-parts": [
        [
          2026,
          11,
          20
        ]
      ]
    },
    "accessed": {
      "date-parts": [
        [
          2026,
          11,
          20
        ]
      ]
    },
    "license": "CC BY-SA 4.0",
    "DOI": "eo1:enwiki-001376833342",
    "isBasedOn": "https://en.wikipedia.org/w/index.php?oldid=1376833342",
    "note": "Immutable snapshot enwiki-001376833342"
  }
}