activity selection problem algorithm