generic algorithms questions and solutions