This book is about data structures and algorithms as used in computer programming. Data structures are ways in which data is arranged in your computer’s memory (or stored on disk).
Algorithms are the procedures a software program uses to manipulate the data in these structures. 2 Data Structures & Algorithms in Java, Second Edition 01 0672324539 intro 10/10/02 9:08 AM Page 2 Almost every computer program, even a simple one, uses data structures and algorithms.
For example, consider a program that prints address labels. The program might use an array containing the addresses to be printed and a simple for loop to step through the array, printing each address. The array in this example is a data structure, and the for loop, used for sequential access to the array, executes a simple algorithm.
For uncomplicated programs with small amounts of data, such a simple approach might be all you need. However, for programs that handle even moderately large amounts of data, or which solve problems that are slightly out of the ordinary, more sophisticated techniques are necessary.
Simply knowing the syntax of a computer language such as Java or C++ isn’t enough. This book is about what you need to know after you’ve learned a programming language.
The material we cover here is typically taught in colleges and universities as a second-year course in computer science, after a student has mastered the fundamentals of programming.