Sorting and searching

From rnavarych/alpha-engineer · View interactive version

Sorting and searching is an AI agent skill from the GitHub repository rnavarych/alpha-engineer. Implements sorting and searching algorithms — comparison sorts (quicksort/introsort, merge sort, heapsort, Timsort), non-comparison sorts (radix, counting, bucket), binary search variants (lower/upper bound, answer-space search), order statistics (quickselect, streaming median), string searching (KM

How to use this skill

Skill file

Sorting and Searching

When to use

Core principles

  1. Timsort wins on real-world data — natural runs and partial ordering are the norm, not the exception
  2. Radix sort beats comparison sorts when key range is bounded — O(dn) < O(n log n) when d is small
  3. Binary search on the answer, not just the array — if you can check feasibility in O(f(n)), you can binary search the answer space
  4. Boyer-Moore is sublinear on average — for single-pattern search on natural text it reads fewer characters than the input length
  5. Aho-Corasick when patterns > 1 — one pass over the text regardless of how many patterns you search for

Reference Files

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.