Cardiopulmonary resuscitation algorithm