How can you modify an algorithm to get best case running time?

1 answer

Answer

1216981

2026-05-06 12:55

+ Follow

To improve the best case, all we have to do it to be able to

solve one instance of each size efficiently. We could modify

our algorithm to first test whether the input is the special

instance we know how to solve, and then output the canned

answer.

E.g. For sorting, we can check if the values are already ordered,

and if so output them.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.