## The Algorithm Design Manual (Texts in Computer Science) 3rd ed. 2020 Edition

“My absolute favorite for this kind of interview preparation is Steven Skiena’s The Algorithm Design Manual. More than any other book it helped me understand just how astonishingly commonplace … graph problems are — they should be part of every working programmer’s toolkit. The book also covers basic data structures and sorting algorithms, which is a nice bonus. … every 1 – pager has a simple picture, making it easy to remember. This is a great way to learn how to identify hundreds of problem types.” (Steve Yegge, Get that Job at Google)

“Steven Skiena’s Algorithm Design Manual retains its title as the best and most comprehensive practical algorithm guide to help identify and solve problems. … Every programmer should read this book, and anyone working in the field should keep it close to hand. … This is the best investment … a programmer or aspiring programmer can make.” (Harold Thimbleby, Times Higher Education)

“It is wonderful to open to a random spot and discover an interesting algorithm. This is the only textbook I felt compelled to bring with me out of my student days… The color really adds a lot of energy to the new edition of the book!” (Cory Bart, University of Delaware)

“The is the most approachable book on algorithms I have.” (Megan Squire, Elon University)

—

This newly expanded and the updated third edition of the best-selling classic continues to take the “mystery” out of designing algorithms and analyzing their efficiency. It serves as the primary textbook of choice for algorithm design courses and interview self-study while maintaining its status as the premier practical reference guide to algorithms for programmers, researchers, and students.

The reader-friendly ** Algorithm Design Manual** provides straightforward access to combinatorial algorithms technology, stressing design over-analysis. The first part, Practical Algorithm Design, provides accessible instruction on methods for designing and analyzing computer algorithms. The second part, the Hitchhiker’s Guide to Algorithms, is intended for browsing and reference and comprises the catalog of algorithmic resources, implementations, and an extensive bibliography.

**NEW **to the third edition:

— **New and expanded coverage** of randomized algorithms, hashing, divide and conquer, approximation algorithms, and quantum computing

— Provides **full online support** for lecturers, including **an improved website component** with lecture slides and videos

— **Full-color illustrations and code** instantly clarify difficult concepts

— Includes several new “war stories” **relating experiences from real-world applications**

— Over **100 new problems**, including programming challenge problems from LeetCode and Hackerrank.

— Provides **up-to-date links **leading to the best implementations available in C, C++, and Java

**Additional Learning Tools: **

— Contains a unique catalog identifying the 75 algorithmic problems that arise most often in practice, leading the reader down the right path to solve them

— Exercises include “job interview problems” from major software companies

— Highlighted “take-home lessons” emphasize essential concepts

— The “no theorem-proof” style provides a uniquely accessible and intuitive approach to a challenging subject

— Many algorithms are presented with actual code (written in C)

— Provides comprehensive references to both survey articles and the primary literature

Written by a well-known algorithms researcher who received the IEEE Computer Science and Engineering Teaching Award, this substantially enhanced third edition of * The Algorithm Design Manual* is an essential learning tool for students and professionals needed a solid grounding in algorithms. Professor Skiena is also the author of the popular Springer texts,

*and*

**The Data Science Design Manual**

**Programming Challenges: The Programming Contest Training Manual.**## Preface

Many professional programmers are not well prepared to tackle algorithm design problems. This is a pity because the techniques of algorithm design form one of the core practical technologies of computer science.

This ebook is intended as a manual on algorithm design, providing access to combinatorial algorithm technology for both students and computer professionals. It is divided into two parts: Techniques and Resources. The former is a general introduction to the design and analysis of computer algorithms. The Resources section is intended for browsing and reference and comprises the catalog of algorithmic resources, implementations, and an extensive bibliography.

### To the Reader

I have been gratified by the warm reception previous editions of The Algorithm Design Manual have received, with over 60,000 copies sold in various formats since first being published by Springer-Verlag in 1997. Translations have appeared in Chinese, Japanese, and Russian. It has been recognized as a unique guide to using algorithmic techniques to solve problems that often arise in practice.

Much has changed in the world since the second edition of The Algorithm Design Manual was published in 2008. The popularity of my book soared as software companies increasingly emphasized algorithmic questions during employment interviews, and many successful job candidates have trusted The Algorithm Design Manual to help them prepare for their interviews.

Although algorithm design is perhaps the most classical area of computer science, it continues to advance and change. Randomized algorithms and data structures have become increasingly important, particularly techniques based on hashing. Recent breakthroughs have reduced the algorithmic complexity of the best algorithms known for such fundamental problems as finding minimum spanning trees, graph isomorphism, and network flows. Indeed, if we date the origins of modern algorithm design and analysis to about 1970, then roughly 20% of modern algorithmic history has happened since the second edition of

*The Algorithm Design Manual**.*

The time has come for a new edition of my book, incorporating changes in the algorithmic and industrial world plus the feedback I have received from hundreds of readers. My major goals for the third edition are:

- To introduce or expand coverage of important topics like hashing, randomized algorithms, divide and conquer, approximation algorithms, and quantum computing in the first part of the book (Practical Algorithm Design).

- To update the reference material for all the catalog problems in the second part of the book (The Hitchhiker’s Guide to Algorithms).

- To take advantage of advances in color printing to produce more informative and eye-catching illustrations.

Three aspects of The Algorithm Design Manual have been particularly beloved:

(1) the hitchhiker’s guide to algorithms, (2) the war stories, and (3) the electronic component of the book. These features have been preserved and strengthened in this third edition:

- The Hitchhiker’s Guide to Algorithms – Since finding out what is known about an algorithmic problem can be a difficult task, I provide a catalog of the seventy-five most important algorithmic problems arising in practice. By browsing through this catalog, the student or practitioner can quickly identify what their problem is called, what is known about it, and how they should proceed to solve it.

I have updated every section in response to the latest research results and applications. Particular attention has been paid to updating discussion of available software implementations for each problem, reflecting sources such as GitHub, which have emerged since the previous edition.

- War stories – To provide a better perspective on how algorithm problems arise in the real world, I include a collection of “war stories”, tales from my experience on real problems. The moral of these stories is that algorithm design and analysis is not just theory, but an important tool to be pulled out and used as needed.

The new edition of the book updates the best of the old war stories, plus adds new tales on randomized algorithms, divide and conquer, and

dynamic programming.

- Online component – Full lecture notes and a problem solution Wiki is available on my website www.algorist.com. My algorithm lecture videos have been watched over 900,000 times on YouTube. This website has been updated in parallel with the book.

Equally important is what is not done in this book. I do not stress the mathematical analysis of algorithms, leaving most of the analysis as informal

arguments. You will not find a single theorem anywhere in this ebook. When more details are needed, the reader should study the cited programs or references. The goal of this manual is to get you going in the right direction as quickly as possible.

### To the Instructor

This book covers enough material for a standard Introduction to Algorithms course. It is assumed that the reader has completed the equivalent of a second programming course, typically titled Data Structures or Computer Science II.

A full set of lecture slides for teaching this course are available online at www.algorist.com. Further, I make available online video lectures using these slides to teach a full-semester algorithm course. Let me help teach your course, through the magic of the Internet!

I have made several pedagogical improvements throughout the book, including:

- New material – To reflect recent developments in algorithm design, I have added new chapters on randomized algorithms, divide and conquer, and approximation algorithms. I also delve deeper into topics such as hashing.

But I have been careful to heed the readers who begged me to keep the book of modest length. I have (painfully) removed less important material to keep total expansion by page count under 10% over the previous edition.

- Clearer exposition – Reading through my text ten years later, I was thrilled to find many sections where my writing seemed ethereal, but other places were a muddled mess. Every page in this manuscript has been edited or rewritten for greater clarity, correctness, and flow.

- More interview resources – The Algorithm Design Manual remains very popular for interview prep, but this is a fast-paced world. I include more and fresher interview problems, plus coding challenges associated with interview sites like LeetCode and Hackerrank. I also include a new section with advice on how to best prepare for interviews.

- Stop and think – Each of my course lectures begins with a “Problem of the Day,” where I illustrate my thought process as I solve a topic-specific homework problem – false starts and all. This edition had more Stop and Think sections, which perform a similar mission for the reader.

- More and better homework problems – The third edition of The Algorithm Design Manual has more and better homework exercises than the previous one. I have added over a hundred exciting new problems, pruned some less interesting problems, and clarified exercises that proved confusing or ambiguous.

- Updated code style – The second edition featured algorithm implementations in C, replacing or augmenting pseudocode descriptions. These have generally been well received, although certain aspects of my programming have been condemned by some as old-fashioned. All programs have been revised and updated, and are structurally highlighted in color.

- Color images – My companion book The Data Science Design Manual was printed with color images, and I was excited by how much this made concepts clearer. Every single image in The Algorithm Design Manual is now rendered in living color, and the process of review has improved the contents of most figures in the text.

## Acknowledgments

Updating a book dedication every ten years focuses attention on the effects of time. Over the lifespan of this book, Renee became my wife and then the mother of our two children, Bonnie and Abby, who are now no longer children. My father has left this world, but Mom and my brothers Len and Rob remain a vital presence in my life. I dedicate this book to my family, new and old, here and departed.

I would like to thank several people for their concrete contributions to this new edition. Michael Alvin, Omar Amin, Emily Barker, and Jack Zheng were critical to building the website infrastructure and dealing with a variety of manuscript preparation issues. Their roles were played by Ricky Bradley, Andrew Gaun, Zhong Li, Betson Thomas, and Dario Vlah on previous editions.

The world’s most careful reader, Robert Piche of Tampere University, and Stony Brook students Peter Duffy, Olesia Elfimova, and Robert Matsibekker read early versions of this edition and saved both you and me the trouble of dealing with many errata. Thanks also to my Springer-Verlag editors, Wayne Wheeler and Simon Rees.

Several exercises were originated by colleagues or inspired by other texts. Reconstructing the original sources years later can be challenging, but credits for each problem (to the best of my recollection) appear on the website.

Much of what I know about algorithms I learned along with my graduate students. Several of them (Yaw-Ling Lin, Sundaram Gopalakrishnan, Ting Chen, Francine Evans, Harald Rau, Ricky Bradley, and Dimitris Margaritis) are the real heroes of the war stories related within. My Stony Brook friends and algorithm colleagues Estie Arkin, Michael Bender, Jing Chen, Rezaul Chowdhury, Jie Gao, Joe Mitchell, and Rob Patro have always been a pleasure to work with.

## Table of Contents

**I Practical Algorithm Design**

*1 Introduction to Algorithm Design*

1.1 Robot Tour Optimization

1.2 Selecting the Right Jobs

1.3 Reasoning about Correctness

1.3.1 Problems and Properties

1.3.2 Expressing Algorithms

1.3.3 Demonstrating Incorrectness

1.4 Induction and Recursion

1.5 Modeling the Problem

1.5.1 Combinatorial Objects

1.5.2 Recursive Objects

1.6 Proof by Contradiction

1.7 About the War Stories

1.8 War Story: Psychic Modeling

1.9 Estimation

1.10 Exercises

*2 Algorithm Analysis*

2.1 The RAM Model of Computation

2.1.1 Best-Case, Worst-Case, and Average-Case Complexity

2.2 The Big Oh Notation

2.3 Growth Rates and Dominance Relations

2.3.1 Dominance Relations

2.4 Working with the Big Oh

2.4.1 Adding Functions

2.4.2 Multiplying Functions

2.5 Reasoning about Efficiency

2.5.1 Selection Sort

2.5.2 Insertion Sort

2.5.3 String Pattern Matching

2.5.4 Matrix Multiplication

2.6 Summations

2.7 Logarithms and Their Applications

2.7.1 Logarithms and Binary Search

2.7.2 Logarithms and Trees

2.7.3 Logarithms and Bits

2.7.4 Logarithms and Multiplication

2.7.5 Fast Exponentiation

2.7.6 Logarithms and Summations

2.7.7 Logarithms and Criminal Justice

2.8 Properties of Logarithms

2.9 War Story: Mystery of the Pyramids

2.10 Advanced Analysis (*)

2.10.1 Esoteric Functions

2.10.2 Limits and Dominance Relations

2.11 Exercises

*3 Data Structures*

3.1 Contiguous vs. Linked Data Structures

3.1.1 Arrays

3.1.2 Pointers and Linked Structures

3.1.3 Comparison

3.2 Containers: Stacks and Queues

3.3 Dictionaries

3.4 Binary Search Trees

3.4.1 Implementing Binary Search Trees

3.4.2 How Good are Binary Search Trees?

3.4.3 Balanced Search Trees

3.5 Priority Queues

3.6 War Story: Stripping Triangulations

3.7 Hashing

3.7.1 Collision Resolution

3.7.2 Duplicate Detection via Hashing

3.7.3 Other Hashing Tricks

3.7.4 Canonicalization

3.7.5 Compaction

3.8 Specialized Data Structures

3.9 War Story: String ’em Up

3.10 Exercises

*4 Sorting*

4.1 Applications of Sorting

4.2 Pragmatics of Sorting

4.3 Heapsort: Fast Sorting via Data Structures

4.3.1 Heaps

4.3.2 Constructing Heaps

4.3.3 Extracting the Minimum

4.3.4 Faster Heap Construction (*)

4.3.5 Sorting by Incremental Insertion

4.4 War Story: Give me a Ticket on an Airplane

4.5 Mergesort: Sorting by Divide and Conquer

4.6 Quicksort: Sorting by Randomization

4.6.1 Intuition: The Expected Case for Quicksort

4.6.2 Randomized Algorithms

4.6.3 Is Quicksort Really Quick?

4.7 Distribution Sort: Sorting via Bucketing

4.7.1 Lower Bounds for Sorting

4.8 War Story: Skiena for the Defense

4.9 Exercises

*5 Divide and Conquer*

5.1 Binary Search and Related Algorithms

5.1.1 Counting Occurrences

5.1.2 One-Sided Binary Search

5.1.3 Square and Other Roots

5.2 War Story: Finding the Bug in the Bug

5.3 Recurrence Relations

5.3.1 Divide-and-Conquer Recurrences

5.4 Solving Divide-and-Conquer Recurrences

5.5 Fast Multiplication

5.6 Largest Subrange and Closest Pair

5.7 Parallel Algorithms

5.7.1 Data Parallelism

5.7.2 Pitfalls of Parallelism

5.8 War Story: Going Nowhere Fast

5.9 Convolution (*)

5.9.1 Applications of Convolution

5.9.2 Fast Polynomial Multiplication (**)

5.10 Exercises

*6 Hashing and Randomized Algorithms*

6.1 Probability Review

6.1.1 Probability

6.1.2 Compound Events and Independence

6.1.3 Conditional Probability

6.1.4 Probability Distributions

6.1.5 Mean and Variance

6.1.6 Tossing Coins

6.2 Understanding Balls and Bins

6.2.1 The Coupon Collector’s Problem

6.3 Why is Hashing a Randomized Algorithm?

6.4 Bloom Filters

6.5 The Birthday Paradox and Perfect Hashing

6.6 Minwise Hashing

6.7 Efficient String Matching

6.8 Primality Testing

6.9 War Story: Giving Knuth the Middle Initial

6.10 Where do Random Numbers Come From?

6.11 Exercises

*7 Graph Traversal*

7.1 Flavors of Graphs

7.1.1 The Friendship Graph

7.2 Data Structures for Graphs

7.3 War Story: I was a victim of Moore’s Law

7.4 War Story: Getting the Graph

7.5 Traversing a Graph

7.6 Breadth-First Search

7.6.1 Exploiting Traversal

7.6.2 Finding Paths

7.7 Applications of Breadth-First Search

7.7.1 Connected Components

7.7.2 Two-Coloring Graphs

7.8 Depth-First Search

7.9 Applications of Depth-First Search

7.9.1 Finding Cycles

7.9.2 Articulation Vertices

7.10 Depth-First Search on Directed Graphs

7.10.1 Topological Sorting

7.10.2 Strongly Connected Components

7.11 Exercises

*8 Weighted Graph Algorithms*

8.1 Minimum Spanning Trees

8.1.1 Prim’s Algorithm

8.1.2 Kruskal’s Algorithm

8.1.3 The Union–Find Data Structure

8.1.4 Variations on Minimum Spanning Trees

8.2 War Story: Nothing but Nets

8.3 Shortest Paths

8.3.1 Dijkstra’s Algorithm

8.3.2 All-Pairs Shortest Path

8.3.3 Transitive Closure

8.4 War Story: Dialing for Documents

8.5 Network Flows and Bipartite Matching

8.5.1 Bipartite Matching

8.5.2 Computing Network Flows

8.6 Randomized Min-Cut

8.7 Design Graphs, Not Algorithms

8.8 Exercises

*9 Combinatorial Search*

9.1 Backtracking

9.2 Examples of Backtracking

9.2.1 Constructing All Subsets

9.2.2 Constructing All Permutations

9.2.3 Constructing All Paths in a Graph

9.3 Search Pruning

9.4 Sudoku

9.5 War Story: Covering Chessboards

9.6 Best-First Search

9.7 The A* Heuristic

9.8 Exercises

*10 Dynamic Programming*

10.1 Caching vs. Computation

10.1.1 Fibonacci Numbers by Recursion

10.1.2 Fibonacci Numbers by Caching

10.1.3 Fibonacci Numbers by Dynamic Programming

10.1.4 Binomial Coefficients

10.2 Approximate String Matching

10.2.1 Edit Distance by Recursion

10.2.2 Edit Distance by Dynamic Programming

10.2.3 Reconstructing the Path

10.2.4 Varieties of Edit Distance

10.3 Longest Increasing Subsequence

10.4 War Story: Text Compression for Bar Codes

10.5 Unordered Partition or Subset Sum

10.6 War Story: The Balance of Power

10.7 The Ordered Partition Problem

10.8 Parsing Context-Free Grammars

10.9 Limitations of Dynamic Programming: TSP

10.9.1 When is Dynamic Programming Correct?

10.9.2 When is Dynamic Programming Efficient?

10.10War Story: What’s Past is Prolog

10.11Exercises

*11 NP-Completeness*

11.1 Problems and Reductions

11.1.1 The Key Idea

11.1.2 Decision Problems

11.2 Reductions for Algorithms

11.2.1 Closest Pair

11.2.2 Longest Increasing Subsequence

11.2.3 Least Common Multiple

11.2.4 Convex Hull (*)

11.3 Elementary Hardness Reductions

11.3.1 Hamiltonian Cycle

11.3.2 Independent Set and Vertex Cover

11.3.3 Clique

11.4 Satisfiability

11.4.1 3-Satisfiability

11.5 Creative Reductions from SAT

11.5.1 Vertex Cover

11.5.2 Integer Programming

11.6 The Art of Proving Hardness

11.7 War Story: Hard Against the Clock

11.8 War Story: And Then I Failed

11.9 P vs. NP

11.9.1 Verification vs. Discovery

11.9.2 The Classes P and NP

11.9.3 Why Satisfiability is Hard

11.9.4 NP-hard vs. NP-complete?

11.10Exercises

*12 Dealing with Hard Problems*

12.1 Approximation Algorithms

12.2 Approximating Vertex Cover

12.2.1 A Randomized Vertex Cover Heuristic

12.3 Euclidean TSP

12.3.1 The Christofides Heuristic

12.4 When Average is Good Enough

12.4.1 Maximum k-SAT

12.4.2 Maximum Acyclic Subgraph

12.5 Set Cover

12.6 Heuristic Search Methods

12.6.1 Random Sampling

12.6.2 Local Search

12.6.3 Simulated Annealing

12.6.4 Applications of Simulated Annealing

12.7 War Story: Only it is Not a Radio

12.8 War Story: Annealing Arrays

12.9 Genetic Algorithms and Other Heuristics

12.10Quantum Computing

12.10.1 Properties of “Quantum” Computers

12.10.2Grover’s Algorithm for Database Search

12.10.3The Faster “Fourier Transform”

12.10.4 Shor’s Algorithm for Integer Factorization

12.10.5 Prospects for Quantum Computing

12.11Exercises

*13 How to Design Algorithms*

13.1 Preparing for Tech Company Interviews

**II The Hitchhiker’s Guide to Algorithms**

*14 A Catalog of Algorithmic Problems*

*15 Data Structures*

15.1 Dictionaries

15.2 Priority Queues

15.3 Suffix Trees and Arrays

15.4 Graph Data Structures

15.5 Set Data Structures

15.6 Kd-Trees

*16 Numerical Problems*

16.1 Solving Linear Equations

16.2 Bandwidth Reduction

16.3 Matrix Multiplication

16.4 Determinants and Permanents

16.5 Constrained/Unconstrained Optimization

16.6 Linear Programming

16.7 Random Number Generation

16.8 Factoring and Primality Testing

16.9 arbitrary-precision Arithmetic

16.10Knapsack Problem

16.11Discrete Fourier Transform

*17 Combinatorial Problems*

17.1 Sorting

17.2 Searching

17.3 Median and Selection

17.4 Generating Permutations

17.5 Generating Subsets

17.6 Generating Partitions

17.7 Generating Graphs

17.8 Calendrical Calculations

17.9 Job Scheduling

17.10Satisfiability

*18 Graph Problems: Polynomial Time*

18.1 Connected Components

18.2 Topological Sorting

18.3 Minimum Spanning Tree

18.4 Shortest Path

18.5 Transitive Closure and Reduction

18.6 Matching

18.7 Eulerian Cycle/Chinese Postman

18.8 Edge and Vertex Connectivity

18.9 Network Flow

18.10 Drawing Graphs Nicely

18.11Drawing Trees

18.12 Planarity Detection and Embedding

*19 Graph Problems: NP-Hard*

19.1 Clique

19.2 Independent Set

19.3 Vertex Cover

19.4 Traveling Salesman Problem

19.5 Hamiltonian Cycle

19.6 Graph Partition

19.7 Vertex Coloring

19.8 Edge Coloring

19.9 Graph Isomorphism

19.10Steiner Tree

19.11Feedback Edge/Vertex Set

*20 Computational Geometry*

20.1 Robust Geometric Primitives

20.2 Convex Hull

20.3 Triangulation

20.4 Voronoi Diagrams

20.5 Nearest-Neighbor Search

20.6 Range Search

20.7 Point Location

20.8 Intersection Detection

20.9 Bin Packing

20.10 Medial-Axis Transform

20.11 Polygon Partitioning

20.12 Simplifying Polygons

20.13 Shape Similarity

20.14 Motion Planning

20.15 Maintaining Line Arrangements

20.16 Minkowski Sum

*21 Set and String Problems*

21.1 Set Cover

21.2 Set Packing

21.3 String Matching

21.4 Approximate String Matching

21.5 Text Compression

21.6 Cryptography

21.7 Finite State Machine Minimization

21.8 Longest Common Substring/Subsequence

21.9 Shortest Common Superstring

*22 Algorithmic Resources*

22.1 Algorithm Libraries

22.1.1 LEDA

22.1.2 CGAL

22.1.3 Boost Graph Library

22.1.4 Netlib

22.1.5 Collected Algorithms of the ACM

22.1.6 GitHub and SourceForge

22.1.7 The Stanford GraphBase

22.1.8 Combinatorica

22.1.9 Programs from Books

22.2 Data Sources

22.3 Online Bibliographic Resources

22.4 Professional Consulting Services

*23 Bibliography*

**Index**

## About the Author

**Dr. Steven S. Skiena** is a Distinguished Teaching Professor of Computer Science at Stony Brook University, with research interests in data science, natural language processing, and algorithms. He was awarded the IEEE Computer Science and Engineering Undergraduate Teaching Award “for outstanding contributions to undergraduate education, and for influential textbooks and software.”

## Reviews of the customers about the ebook:

- Andi:

covers all the basic algorithms that any and every programmer and data scientist is expected to know.

For anybody with a CS degree, this is just a review. –– but I like only having to look in a single book for all the basic algorithms.

Not what I was hoping for, but I’m satisfied with the depth and quality of the information. - Manish Mishra:

Still learning but great book. - Philippe Fanaro:

A work of art and mastery of many fields. Decades and decades of research in addition to the much more valuable big picture of their integration. This is *the* book to bridge the gap between theory and practice.

I don’t know if this book could be read with someone with zero knowledge of the topics involved. I am a graduate student of electrical engineering who knew a reasonable lot before trying this book out and, still, couldn’t read more than 40-60 pages a day (I separated 2 weeks off for this book). - Ivan:

When you want to read a good introductory book about algorithms and data structures the choice comes down to two books: Introduction to Algorithms, Second Edition, and this one. I especially liked The Algorithm Design Manual because of the author’s writing style, the “war stories” (that are some clever and practical applications of the data structures and algorithms the author tries to teach you), and the second half part of the book which is a sort of encyclopedia of problems.

I used the “introductory” adjective earlier as this is supposed to be an introductory book on the topic. In reality, even though it starts from the basics of math and programming, the topics covered are broad enough and discussed in much depth to make it appealing even to the senior programmer.

In short, this is an ebook every decent programmer should read at least once, besides it works also as a algorithms/data structures encyclopedia that always comes in handy. - Snotnose:

Holy crap, wish I’d found this book before I retired. I’ve been recommending Sedgwick’s book for 30 years, this one is even better.

Something I really like is how he shows how useful graph theory can be. If you can turn your problem into a graph (and you’d be surprised how often you can) there are a lot of non-obvious algorithms that will beat the pants of any non-graphical algorithm. I got a B.A. in math, the most useful class I took was graph theory. - John:

It is a solid ebook. As to the answers for the exercises, they will be developed as time goes on. The content is what is needed to understand algorithms and pass the majority of coding interviews. - Christian Brumm:

In comparison to “Introduction to Algorithms” (the other algorithm book I had significant exposure to), this one is faster to read, easier to digest, and more tailored towards applications.

I found the “Hitchhiker’s Guide to Algorithms” in the back to be extremely useful if you really find yourself tackling an algorithmic problem in practice.

The main part (maybe skipping/skimming down a few chapters) is very good preparation for algorithm-heavy job interviews (e.g. Google, Facebook, etc …).

Very much recommended. - Ben Yang:

The best algorithm ebook I read, ever. - Priyanka Shah:

An amazing and informative book for anyone interested in knowing how algorithms shape the world we live in and power almost all the electronic machines we interact with on day to day basis. Most importantly gives you a zoom-out version to analyze and break down big problems into small informative chunks which can then be processed to get a value. - Alexey Zorin:

This ebook is just a bit less academic and a bit more casual than the famous “Introduction to Algorithms” however it’s all about applications.

Every chapter starts off with a problem statement, then questions are asked to help identify hidden nuances of the problem, followed by a “War story” showing where exactly that particular algorithm found its application and tricky exercises of course.

The author provides dozens of references to each topic so the reader could study the particular subject in detail.

As well as “Introduction to Algorithms” requires a strong background in Math (geometry, calculus) and CS. - Fatima:

My favorite Algorithms ebook. I will always read and re-read it. - Mayur Patil:

Excellent Book but obviously not for beginners. You need to do a refresher course in Algorithms or take one if you are graduating. You will become a good problem solver and algorithmic after completing this text. Go for it if you want to challenge your algorithmic learning. - Christina:

If you are a self-taught software engineer like me this book is an amazing resource for not only preparing for technical interviews but getting into a rhythm of thinking like a computer scientist and breaking from being just a programmer - Raj:

For some people which may have graduated such as myself and looking to get into software developer roles.. this book is for you.

Now, this ebook is a bit complex in certain topics, so you may want to go through your old university lecture slides or revise a bit on algorithms and data structures before this book.

I haven’t read the older version, so cannot say much about how great this new one is compared to the old one. - Vikas Srivastava:

An excellent book-taking a hands approach to solving algorithmic problems. A brief introduction to the algorithms followed by specific implementations of everyday problems makes it truly a ‘Hitchhiker’s Guide to Algorithms’ - Kirill:

Most of the books in this category provide a rigorous catalog of different algorithmic problems and their solutions, and this one is not an exception. At least it’s the second part. What makes this books stand out is its first half. There, the author provides a practical view on solving algorithmic problems, providing intuitive explanations of the major problems in each category. Each of the first 10 chapters also contains war stories, where the algorithms are brought to real practical applications based on the author’s experience.

And if you’ll need a more complete reference, the second part of the book contains a more traditional collection of various algorithms with topics ranging from sorting to black-box optimization. - Dawn Drain:

Skiena is an extremely likable author! I loved his stories and sense of humor. I think I’d recommend this book over CLRS, although I could imagine a past version of myself being frustrated by the practical lack of detail.

## Reviews

There are no reviews yet.