Prabekhar's algorithm | ScratchStats