A ball dropped from height h0 hits the floor with speed v = sqrt(2 g h0). The coefficient of restitution e = v_after / v_before scales the speed at every impact, so the rebound height scales as e^2: the n-th peak is h_n = h0 e^(2n). Each bounce keeps the fraction e^2 of the mechanical energy; the rest becomes heat and sound.
Flight times form a geometric series, so the ball makes infinitely many bounces in a finite time T = sqrt(2 h0 / g) (1 + e) / (1 - e) (the 'Zeno' stopping time). The dashed lines are the predicted peaks. Gravity changes the clock (T ~ 1/sqrt(g)) but not the height ratios.
Simplifications: no air drag, a point-contact rigid floor, and a constant e (real e falls with impact speed). The numerical checks use a separate fine time step and compare the third peak and the time of the 40th impact.