Posts

Showing posts from October, 2026

LazySort How-To Guide

Image
LazySort is designed to retrieve elements by index from an unsorted dataset as if the dataset were fully sorted, without sorting the entire dataset or consuming excessive memory. It is ideal when sorting the entire dataset is impractical, but specific indexed elements (such as the median or a specific percentile) need to be retrieved. Additionally, it can determine the index of an element in the sorted representation of the dataset. Overview The core algorithm consists of two phases: Analysis & Clustering: Analyzes the raw dataset and partitions it into indexed clusters. In-Memory Sort & Retrieval: Loads and sorts only the single cluster containing the requested element, then returns the target item. If a cluster containing the requested item exceeds the user-defined memory limit, it is dynamically re-partitioned into smaller sub-clusters. Installation Using pip: pip install lazysort Using uv: uv add lazysort Source code ava...