O'Reilly logo

A Common-Sense Guide to Data Structures and Algorithms by Jay Wengrow

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6Optimizing for Optimistic Scenarios

When evaluating the efficiency of an algorithm, we’ve focused primarily on how many steps the algorithm would take in a worst-case scenario. The rationale behind this is simple: if you’re prepared for the worst, things will turn out okay.

However, we’ll discover in this chapter that the worst-case scenario isn’t the only situation worth considering. Being able to consider all scenarios is an important skill that can help you choose the appropriate algorithm for every situation.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required