interactive lab

KKsort Demo + Benchmark

Play with all sorting/search functions and benchmark both categories on shared datasets.

6 Sorting Functions4 Search FunctionsTwo Benchmark TablesCopyable Snippets

Sorting Demo

Switch algorithms and ordering strategy on the same input.

Complexity: O(n log n) / O(n log n) / O(n^2)

Stable: No

Fast in practice for general workloads.

Parsed Input

[
  64,
  34,
  25,
  12,
  22,
  11,
  90
]

Sorted Result

[
  11,
  12,
  22,
  25,
  34,
  64,
  90
]

Search Demo

Pick any search function and inspect before/after arrays.

Algorithm Info

Complexity: O(1) / O(log n) / O(log n)

Requires Sorted: Yes

Mutates Array: No

Best for sorted datasets.

Dataset Before Search

[
  1,
  3,
  5,
  7,
  9,
  11,
  13
]

Dataset After Search

[
  1,
  3,
  5,
  7,
  9,
  11,
  13
]

Search Result

Found target 7 at index 3

Benchmark: Sorting Algorithms

Run all sorting functions on the same random dataset and compare speed ranking.

Benchmark: Search Algorithms

Benchmarks all search functions using a shared target value (binary/jump use sorted source).

Sorting example

import { mergeSort } from "@kktestdev/kksort/merge";

const employees = [
  { name: "Alice", salary: 50000 },
  { name: "Bob", salary: 80000 },
  { name: "Charlie", salary: 60000 },
];

const sorted = mergeSort(employees, (a, b) => a.salary - b.salary);

Search example

import { binarySearch } from "@kktestdev/kksort/binary";
import { quickSearch } from "@kktestdev/kksort/quick-search";

const sortedNumbers = [1, 3, 5, 7, 9, 11, 13];
const exactIndex = binarySearch(sortedNumbers, 7);

const unsortedNumbers = [7, 4, 9, 1, 5, 8];
const quickIndex = quickSearch([...unsortedNumbers], 5);