Algorithm analysis design shortest path problem