Algorithms Design and Analysis