Computer algorithms : introduction to design and analysis