successive elimination algorithm