rebuy interview question

how do you decide which algorithm to use?