Analysis and Design of Algorithms