# Beginning Algorithms

ISBN: 978-0-7645-9674-2
600 pages
November 2005

## Description

Beginning Algorithms

A good understanding of algorithms, and the knowledge of when to apply them, is crucial to producing software that not only works correctly, but also performs efficiently. This is the only book to impart all this essential information-from the basics of algorithms, data structures, and performance characteristics to the specific algorithms used in development and programming tasks.

Packed with detailed explanations and instructive examples, the book begins by offering you some fundamental data structures and then goes on to explain various sorting algorithms. You'll then learn efficient practices for storing and searching by way of hashing, trees, sets, and maps. The authors also share tips on optimization techniques and ways to avoid common performance pitfalls. In the end, you'll be prepared to build the algorithms and data structures most commonly encountered in day-to-day software development.

What you will learn from this book

• The basics of algorithms, such as iteration and recursion
• Elementary data structures such as lists, stacks, and queues
• Basic and advanced sorting algorithms including insertion sort, quicksort, and shell sort
• Advanced data structures such as binary trees, ternary trees, and heaps
• Algorithms for string searching, string matching, hashing, and computational geometry
• How to use test-driven development techniques to ensure your code works as intended
• How to dramatically improve the performance of your code with hands-on techniques for profiling and optimization

Who this book is for

This book is for anyone who develops applications, or is just beginning to do so, and is looking to understand algorithms and data structures. An understanding of computer programming is beneficial.

Wrox Beginning guides are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that will guide you through all the techniques involved.

See More

Acknowledgments.

Introduction.

Chapter 1: Getting Started.

Chapter 2: Iteration and Recursion.

Chapter 3: Lists.

Chapter 4: Queues.

Chapter 5: Stacks.

Chapter 6: Basic Sorting.

Chapter 8: Priority Queues.

Chapter 9: Binary Searching and Insertion.

Chapter 10: Binary Search Trees.

Chapter 11: Hashing.

Chapter 12: Sets.

Chapter 13: Maps.

Chapter 14: Ternary Search Trees.

Chapter 15: B-Trees.

Chapter 16: String Searching.

Chapter 17: String Matching.

Chapter 18: Computational Geometry.

Chapter 19: Pragmatic Optimization.

Appendix B: Resources.

Appendix C: Bibliography.

Index.

See More

## Author Information

Simon Harris started writing animated sprites on a Commodore 64 in primary school. After a break of many years, he taught himself 80x86 and IBM System/370 assembler and started working professionally. Since then he has moved from assembler to C, C++, and, of course, Java. He believes a fundamental understanding and appreciation of algorithms is essential to developing good software; and since starting his own company, RedHill Consulting, he has managed to make a living discussing and demonstrating software development practices and techniques to anyone who will listen.

In his more than 15 years of development experience, James Ross has ranged from building packaged products to large enterprise systems to research into compilers and languages. In recent years, he has become a code quality fanatic and agile methods specialist, particularly with test-driven development. He works as a consultant for ThoughtWorks, the world’s leading agile software development company. He is currently leading the development of a large J2EE project in the insurance industry in Melbourne, Australia. He lives with his wife and family in Melbourne.

See More

Download a single .zip file containing all the java code referenced in the book. You must uncompress the file before using. Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR.
See More

## Errata

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
5 Line Labeled Incorrectly
Figure 1-1:

The straight, horizontal (as opposed to the diagonal) line should be O(1);
it's incorrectly labelled as O(N).
1/12/06
9 Error in Values
"As you can see, for values of N up to and including N=2"

should be:

"As you can see, for values of N up to and including N=3"
02/25/2008
13 Error in Text
Paragraph 3:

"assertequals"
should be:
"assertEquals"

paragraph 4:

"asserttrue"
should be:
"assertTrue"
1/12/06
16 Missing Symbols
32 = 3 x 3 = 9 and 106 = 10 x 10 x 10 x 10 x 10 x 10 = 1,000,000 should be: 3^2 = 3 x 3 = 9 and 10^6 = 10 x 10 x 10 x 10 x 10 x 10 = 1,000,000
05/21/07
24 Error in Code
1st Code block, 4th line of code:
private final int _start;

Should be:
private final int _first;

AND

5th line of code: private final int _end;

Should be:
private final int _last;
10/26/06
255 Error in Text
Paragraph 3:

"The only method you tested was delete()."

"The only other method you tested was delete()."
1/12/06
403 Error in Text
Paragraph 3:

"The original Boyer-Moore algorithm actually makes use of the heuristic suffix."