ON OPTIMAL MARKING ALGORITHMS