2026-07-072026-07-07http://salesiana.dossiersoluciones.com/handle/123456789/17280A fast algorithm to study one-dimensional self-gravitating systems, and, more generally, systems that are Lagrangian integrable between collisions, is presented. The algorithm is event-driven, and uses a heap-ordered set of predicted future events. In the limit of large number of particles $N$, the operation count is dominated by the cost of reordering the heap after each event, which goes asymptotically as $\log N$. Some applications are discussed in detail.submitted to J. Comput. PhysDisordered Systems and Neural NetworksAstrophysicsChaotic DynamicsHeap-based algorithm for one-dimensional particle systemstext