Skip to content
Skills Library
Programming · Building & coding

role-algorithms:sorting-and-searching

/role-algorithms:sorting-and-searching

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 (KMP, Rabin-Karp, Boyer-Moore, Aho-Corasick, suffix arrays), and external sorting. Use when implementing sort orders, optimizing search in sorted data, multi-pattern string matching, or sorting data larger than memory.

Licence
MIT
Last repository change
24.07.2026

Assessment and security

80/ 100Class: good
Format15 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 24.07.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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 (KMP, Rabin-Karp, Boyer-Moore, Aho-Corasick, suffix arrays), and external sorting. Use when implementing sort orders, optimizing search in sorted data, multi-pattern string matching, or sorting data larger than memory.

Original author description

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 (KMP, Rabin-Karp, Boyer-Moore, Aho-Corasick, suffix arrays), and external sorting. Use when implementing sort orders, optimizing search in sorted data, multi-pattern string matching, or sorting data larger than memory.

How it works

  1. When to use
  2. Core principles
  3. Reference Files
Original SKILL.md headings · 23 lines, 264 words
SKILL.md preview
---
name: role-algorithms:sorting-and-searching
description: 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 (KMP, Rabin-Karp, Boyer-Moore, Aho-Corasick, suffix arrays), and external sorting. Use when implementing sort orders, optimizing search in sorted data, multi-pattern string matching, or sorting data larger than memory.
allowed-tools: Read, Grep, Glob, Bash
---

# Sorting and Searching

## When to use
- Selecting a sorting algorithm based on stability, memory, key type, or data distribution
- Implementing lower/upper bound binary search or binary search on an answer space
- Finding the k-th smallest element or maintaining a streaming median
- Implementing single-pattern (KMP, Boyer-Moore) or multi-pattern (Aho-Corasick) string matching
- Building suffix arrays for repeated substring queries on large texts
- Sorting datasets that exceed available memory (external k-way merge sort)

## 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
- `references/comparison-and-noncomparison-sorts.md` — quicksort (introsort fallback), merge sort, heapsort, Timsort (galloping mode), comparison lower bound, counting sort, radix sort (LSD/MSD), bucket sort with selection guide
- `references/binary-search-and-order-statistics.md` — standard search, lower/upper bound (bisect_left/right), binary search on answer space, fractional binary search, quickselect, median-of-medians, streaming median with two heaps
- `references/string-searching-and-external.md` — KMP failure function, Rabin-Karp rolling hash, Boyer-Moore bad-character and good-suffix rules, Aho-Corasick automaton, suffix arrays with LCP, external k-way merge sort, I/O optimization strategies
Files in this package (4)
  • SKILL.md 2 KB
  • references/binary-search-and-order-statistics.md 2 KB
  • references/comparison-and-noncomparison-sorts.md 2 KB
  • references/string-searching-and-external.md 3 KB

Versions

The database has no other skills named role-algorithms:sorting-and-searching.

Database snapshot: 13.11.2026 · package version 5de1e5a8f6c1 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100sorting-searching
    Use when implementing or selecting sorting and searching algorithms. Covers comparison sorts (Quicksort, Mergesort, Heapsort, Insertion sort, Timsort), linear sorts (Counting, Radix, Bucket), and searching techniques (binary search, interpolation search, two pointers, sliding…
  • 100computer-science-algorithms
    Choosing or implementing an algorithm or data structure — asymptotic complexity, data-structure selection, sorting & searching, dynamic programming, graph algorithms, divide & conquer, greedy algorithms, string/sequence algorithms, and the at-scale toolbox (Bloom filters,…
  • 100sorting-parameter-handler
    Manage sorting parameter handler operations. Auto-activating skill for API Development. Triggers on: sorting parameter handler, sorting parameter handler Part of the API Development skill category. Use when working with sorting parameter handler functionality. Trigger with…
  • 90locale-aware-sorting
    Sort and compare text using locale collation rather than byte order, so lists read correctly in every language. Use when displaying sorted names, searching case-insensitively, or matching user input.
  • 100api-filtering-sorting
    Builds flexible API filtering and sorting systems with query parameter parsing, validation, and security. Use when implementing search endpoints, building data grids, or creating dynamic query APIs.
  • 100dsa-binary-search-matrix-search-variants
    Use this skill when searching sorted arrays, rotated arrays, 2D sorted matrices, or continuous monotonic answer spaces in O(log N).

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.