This journey into the world of algorithms begins with some preparation and background information. You'll need to know a few things before learning the many algorithms and data structures in the rest of the book. Although you're keen to get going, reading this chapter will make the rest of the book more useful for you, as it includes concepts that are prerequisites for understanding the explanations of all the code and the analyses of the algorithms themselves.
This chapter discusses:
What an algorithm is
The role of algorithms in software and everyday life
What is meant by the complexity of an algorithm
Several broad classes of algorithm complexity that enable you to distinguish quickly between different solutions to the same problem
What unit testing is and why it is important
How to write unit tests with JUnit
Perhaps you already know that algorithms are an important part of computing, but what exactly are they? What are they good for? And should you even care?
Well, as it turns out, algorithms aren't just limited to computing; you use algorithms every day of your life. In simple terms, an algorithm is a set of well-defined steps required to accomplish some task. If you've ever baked a cake, or followed a recipe of any kind, then you've used an algorithm.
Algorithms also usually involve taking a system from one state to another, possibly transitioning through a series of intermediate states along the way. Another example of ...