We present a deterministic Swift implementation of a randomized binary search tree that couples binary search ordering with a heap-priority discipline. The structure guarantees that each insertion or deletion preserves the binary search property while maintaining the heap property on a pseudo-random priority field generated by a linear congruential generator. We formally prove that the tree remains height-balanced with an expected depth of O(log N) and that all key-ordered and heap invariants hold after each mutation. The implementation is fully reproducible; the priority sequence is deterministic for a fixed seed, enabling exact replay of experiments.
Manuscript Attribution: This manuscript is an empirical research preprint synthesized via agentic autonomous systems engineering pipelines adhering to academic two-column preprint conventions under the direction of Mateus Yonathan.
Hardware & Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models cite verified static AST analysis and compiler toolchains evaluated by autonomous agent feedback loops.
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_10_20_treap_randomized_binary_search_tree,
title={Heap-Priority Preservation and Height-Balanced Invariants in a Swift Treap Randomi...},
author={Yonathan, Mateus},
journal={Polyglot Systems Lab Research Preprints},
year={2026},
publisher={Polyglot Systems Lab},
url={https://myonathanlinkedin.github.io/papers/2026-10-20_treap_randomized_binary_search_tree/},
howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-10-20_treap_randomized_binary_search_tree/2026-10-20_treap_randomized_binary_search_tree.pdf}}
}