Search Algorithms
Reference comparison of fundamental search algorithms.
Reference comparison of fundamental search algorithms.
Searching algorithms with best, average and worst time, space and a description: linear, binary, jump, interpolation, exponential and ternary search, plus Fibonacci search, hash-based lookup and binary-search-tree lookup.
| Name | Best | Average | Worst | Space | Description |
|---|---|---|---|---|---|
| Linear Search | O(1) | O(n) | O(n) | O(1) | Sequentially checks each element until the target is found. |
| Binary Search | O(1) | O(log n) | O(log n) | O(1) | Repeatedly divides a sorted interval in half. |
| Jump Search | O(1) | O(sqrt n) | O(sqrt n) | O(1) | Jumps ahead by fixed steps and then performs linear search. |
| Interpolation Search | O(1) | O(log log n) | O(n) | O(1) | Estimates position using interpolation for uniformly distributed data. |
| Exponential Search | O(1) | O(log n) | O(log n) | O(1) | Finds range by repeated doubling then binary searches within it. |
| Ternary Search | O(1) | O(log n) | O(log n) | O(1) | Divides the array into three parts and narrows the interval. |
| Fibonacci Search | O(1) | O(log n) | O(log n) | O(1) | Divides a sorted array using Fibonacci numbers, using only addition and subtraction. |
| Hash-Based Lookup | O(1) | O(1) | O(n) | O(n) | Computes a hash of the key to find its bucket directly. |
| Binary Search Tree Lookup | O(1) | O(log n) | O(n) | O(1) | Follows left and right branches by comparing keys; worst case occurs in an unbalanced tree. |
The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.
| Section | Field | Type | Example |
|---|---|---|---|
| data | name | string | Linear Search |
| data | best | string | O(1) |
| data | average | string | O(n) |
| data | worst | string | O(n) |
| data | space | string | O(1) |
| data | description | string | Sequentially checks each element until the targ… |
The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.
curl "https://yjtoon.com/api/dataset/search-algorithms?format=toon"
const res = await fetch( "https://yjtoon.com/static-data/dataset/search-algorithms.toon" ); const toon = await res.text();
Rate limit: 120 requests per minute per IP, no key and no signup. API reference →