We study the online scheduling problem on a single processor with two agents that submit jobs sequentially. The objective is to minimize the makespan while preserving a strict height-balanced invariant on an auxiliary balanced search tree that indexes pending jobs. We propose a deterministic C implementation that maintains the invariant through local rotations and a priority-based dispatch rule. The algorithm achieves an asymptotic worst-case bound of O(log N) for insertion, deletion, and query operations, where N is the number of pending jobs, and guarantees that the makespan equals the sum of all processing times. Formal invariants are proven using a structural induction on the tree, and static analysis confirms the absence of memory-leak and pointer-aliasing violations.
Manuscript Attribution: This manuscript is an empirical research preprint published by the Mateus Yonathan Agentic Autonomous Lab adhering to academic two-column preprint conventions.
Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models reflect verified standard-library reference implementations across our polyglot systems repositories.
Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.
@article{yonathan2026_2026_11_17_an_optimal_online_algorithm_for_sin,
title={Height-Balanced Invariant Preservation in an Online Two-Agent Single-Machine Scheduler},
author={Yonathan, Mateus},
journal={Polyglot Systems Lab Agentic Research Preprints},
year={2026},
publisher={Polyglot Systems Lab},
url={https://myonathanlinkedin.github.io/papers/2026-11-17_an_optimal_online_algorithm_for_sin/},
howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-11-17_an_optimal_online_algorithm_for_sin/2026-11-17_an_optimal_online_algorithm_for_sin.pdf}}
}