Jump to ratings and reviews
Rate this book


Rate this book
This fourth edition of Robert Sedgewick and Kevin Wayne's Algorithms is the leading textbook on algorithms today and is widely used in colleges and universities worldwide. This book surveys the most important computer algorithms currently in use and provides a full treatment of data structures and algorithms for sorting, searching, graph processing, and string processing -- including fifty algorithms every programmer should know. In this edition, new Java implementations are written in an accessible modular programming style, where all of the code is exposed to the reader and ready to use.

The algorithms in this book represent a body of knowledge developed over the last 50 years that has become indispensable, not just for professional programmers and computer science students but for any student with interests in science, mathematics, and engineering, not to mention students who use computation in the liberal arts.

The companion web site, algs4.cs.princeton.edu contains An online synopsis Full Java implementations Test data Exercises and answers Dynamic visualizations Lecture slides Programming assignments with checklists Links to related material
The MOOC related to this book is accessible via the "Online Course" link at algs4.cs.princeton.edu. The course offers more than 100 video lecture segments that are integrated with the text, extensive online assessments, and the large-scale discussion forums that have proven so valuable. Offered each fall and spring, this course regularly attracts tens of thousands of registrants.

Robert Sedgewick and Kevin Wayne are developing a modern approach to disseminating knowledge that fully embraces technology, enabling people all around the world to discover new ways of learning and teaching. By integrating their textbook, online content, and MOOC, all at the state of the art, they have built a unique resource that greatly expands the breadth and depth of the educational experience.

976 pages, Hardcover

First published January 1, 1983

Loading interface...
Loading interface...

About the author

Robert Sedgewick

65 books72 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
955 (56%)
4 stars
536 (31%)
3 stars
164 (9%)
2 stars
29 (1%)
1 star
14 (<1%)
Displaying 1 - 30 of 64 reviews
Profile Image for Ruxandra.
75 reviews1 follower
May 4, 2013
I bought this book for the course on coursera.org. I ordered it from informit and it arrived immediately.
It is a beautiful hardback edition, with ~950 fine quality pages and typography.

I love it, I used it a lot in my assignments and exercises, it is really clear and helpful, the index makes it very easy to find the answer to your questions.
The first part of the course covered half of it, and I will take the other part too, because the professor makes it really pleasant to study algorithms.
Profile Image for Ivan Atanasov.
113 reviews4 followers
December 4, 2015
The only reason not giving 5 starts is that the book is too much concentrated on Java programming language..
Profile Image for Borys.
106 reviews29 followers
January 10, 2014
First of all, the book has excellent and free site with exercises, presentations, and examples at http://algs4.cs.princeton.edu/ which is great ! Then, there are 2 courses by prof. Sedgewick at Coursera, which is great also. There are lots of diagrams, and algorithm traces, and also lots of useful exercises to do by yourself.
Well, and what I don't like is that there are passages that go like 'this should be obvious from ...' and you're like 'What? Why this is obvious, it is not obvious for me at all !!!' But I think every book on algorithm has such passages. Other than that I like this text very much.

There are also minor drawbacks like, for instance, Java code doesn't always follow Java code style conventions, and maybe some other issues but they are not very important for me.

Of course, reading the book, and not doing any exercises is not very helpful but overall I got myself acquainted with lots of very elegant and beautiful ideas in the field of computer science and that was amazing.

P.S. And by the way, Kindle version has some errors and typos in it. Overall it's good, and it has nice code images that fit into one screen, but sometimes it's hard to identify errors, that's all.
Author 2 books6 followers
November 21, 2016
This is far more approachable than CLRS, yet more thorough than Skiena's The Algorithm Design Manual. It doesn't cover as much ground - certainly not when compared to CLRS. For instance, there is no mention of dynamic programming and no general discussion of greedy algorithms.

But what it does discuss is thoughtfully presented in a meaningful sequence so this can, and should, be read cover to cover. It seems like the product of someone who has considered the material deeply from several angles over many years. I knew most of the material already, but this book gave me several fresh perspectives and unexpected new insights.

The source code is Java, which I much prefer to the pseudo code in CLRS or the C in Skiena's book. However, the first 200 pages or so are a rather dry introduction to Java which doesn't really belong in an algorithms book and which most people can skip. The Java in the book is very simple and it's not unreasonable to expect everyone to know that much Java already.

Oddly, the authors avoid using big-O notation, often discussing constant factors that don't seem like they could be particularly relevant compared to how CPU memory cache behaviour (data locality) would affect efficient implementations of different algorithms, particularly as the code is in Java.

Though the graph section mentions the Ford-Fulkerson Max-Flow algorithm, it doesn't mention the all-pairs shortest paths algorithms such as Floyd-Warshall, usually dealt with first - maybe because it belongs in a discussion of dynamic programing.

It does have some excellent explanations of the Knuth-Morris-Pratt, Boyer-Moore and Rabin-Karp algorithms for substring search, explaining them in terms of deterministic finite state automata. That leads to a really good section on implementing regular expression searches with non-deterministic finite state automata. These really expanding my mind.
Profile Image for Gabriel.
15 reviews
May 17, 2013
I read this textbook while taking Sedgewick's online Algorithms class on coursera.com. It covers the fundamental algorithms in searching, sorting, graphs, and string processing. There's a consistent focus on application examples, which really helps provide useful context. I found the explanations very clear and easy to follow.
A strength of the book is that all algorithms are given in real working Java code, and great care has been given to making the code concise and readable. This can also be seen as a weakness, as large portions of the book are devoted to introducing a basic Java programming model, and to discussing specific Java implementation details. As someone who writes code for a living, I really appreciated this aspect of the presentation, but I could understand if someone else found it distracting.
Overall, this is an excellent work for learning the fundamental algorithms of computer science from a very practical and applications oriented perspective. Highly recommended.
Profile Image for Tony Poerio.
212 reviews11 followers
May 6, 2016
A friend of mine calls Sedgewick his "CS Yoda". Not sure if I totally agree--BUT, I used this book for a class on Algorithms and would recommend. The material isn't easy (and some of it is dry), but Sedgewick is an extraordinarily clear writer, and his code snippets are instructive for gaining the necessary intuition to start using these algorithms in practice. There are many, many books on algorithms out there, and if you're not sure which to use, the choice can be kind of paralyzing. That said, you can't go wrong with this one. Would also recommend checking out his online materials for extra info: http://algs4.cs.princeton.edu/home/
Profile Image for David.
6 reviews1 follower
December 10, 2021
The second edition is very well written, doesn't get caught up in language specifics, and is a must read for anyone serious about programming or computer science.

Unfortunately future editions seem to devolve into the obsession with Java language implementation that is a plague on many modern algorithms textbooks. If you've found a second hand copy, flip through a bit and see if anyone is gushing over automated garbage collection, and run away if it's getting in the way of content.
Profile Image for Amr Wahby.
29 reviews7 followers
September 28, 2013
the book is good, and discuss the topic in easy way , but it dont have evrey thing and need mor example.
Profile Image for Alexander.
68 reviews45 followers
June 12, 2022
I loved that:

1. This book used Java instead of some weird language like Lisp, Pyret, Oz or pseudocode. Java is simple, straightforward, ubiquitous and has a colossal community.
2. The word "lemma" doesn't appear anywhere in this book, and there are no pages that consist purely of opaque mathematical proofs. This book focuses on intuition, not rigorous proofs.
3. This book's illustrations are beautiful and aid with understanding.
4. This book focuses entirely on providing students with a solid foundation. It skips specialised topics like dynamic programming, quantum algorithms and machine learning, which some other algorithms books use as marketing gimmicks.

This is a high-quality book on computing that I highly recommend.
1 review
February 5, 2017
Fundamental basic algorithm book. Must read for new programmers that want to get more advanced. Definitely a classic book for starters and one of the most traditional stepping stones to bigger things.
October 26, 2021
If you're a java person nad want to learn algorithms in linear, structured way this is a really good book. To some extent you can use it with other languages (e.g. with c#, like I did), but in such case getting pseudocode-based book on the subject seems to be a better idea.
December 22, 2020
Very comprehensive textbook on algorithms and data structures. I've read the whole book. Sometimes it was hard to comprehend and I had to re-read few parts. But I really enjoyed reading it. Strong five stars and highly recommended.
Profile Image for Teejay.
121 reviews
May 3, 2022
This should probably be three stars, but I just can't make myself say "I liked it" because it's attached to the worst class I've ever taken. The book is fine and presents Algorithms in a decent way. The companion videos are very helpful for breaking down the examples. But this is material that I would only read if I were taking a class for it or was a hardcore programmer.
Profile Image for Rabib.
9 reviews
June 19, 2020
Together with the corresponding course, I gained a wealth of knowledge concerning algorithms and data structures. The book will serve as a useful reference going forward.
15 reviews11 followers
February 13, 2017
It is a very catchy book. The explanation schema chosen by the authors is very good - a problem definition, a problem solution (algorithm overview), an application of the solutions, a summary/comparison of the approaches, and a brief history (sometimes). I think, the context of ideas (algorithms) is as important as the ideas (algorithms) themselves. Nowadays, there exist many ("documentation-driven") (text)books. However, I think that a modern textbook should give to readers not only the description, but also the context (history, application and so on). And so this is a great merit for the book.

On the other hand, main flaws are that several interesting problems are left as exercises and the concept of balanced search trees is explained very poorly. I think, BST could be explained more generally and so Red-Black trees, Splay trees, or AVL trees will be just an example how the general approach should be used. I also do not like that Red-Black trees are the only approach that is explained in more detail.
October 19, 2017
This is essentially the greatest Algorithms Text ever. Cormen(Introduction to Algorithms ) is wide in breadth but not deep enough. Chapters finish too soon without exploring and investigating the data structure properly, and running after other, more advanced structures.

This book is thorough. The chapters on Red-Black trees (which come after introducing 2-3 Trees, as it should) and on Graphs are the best you can find in the world.
Profile Image for Taj Bortz.
24 reviews1 follower
July 15, 2014
This book is a great book for not only algorithms, but it takes the time to give you a much greater understanding of many basics of programming. I loved the writing style, the pace, the content. They build up, so you will profit most by reading it cover-to-cover.

This is mostly using Java, so it is especially wonderful for a Java developer. But the topics are generally universal, so don't let that keep you from reading it.
Profile Image for Kaung Si Thu.
6 reviews1 follower
June 6, 2019
I read this book together with Mark Allen's C++ data structures and algorithm analysis book. And I would say this book has more visual materials for explanations on algorithms. No fancy functions for codes, just readable and clean ones. So, unlike Mark's C++ version, u might not want to use this book to study current(somewhat) ways to write languages but to see the topics more.
Profile Image for Krzysztof.
52 reviews
March 24, 2023
I can honestly say that this was the first textbook I ever carefully read almost from cover to cover. An extremely helpful book with handy examples, breakdowns and implementation discussions covering every single detail you can think of when implementing algorithms. It takes some time, but it's... heck, it's pleasant!
March 5, 2023
"Algorithms" is a comprehensive textbook on algorithms and data structures, written by one of the leading authorities in the field, Robert Sedgewick. The book provides a detailed and rigorous treatment of the subject matter, while still being accessible to a wide audience, including students and professionals in computer science and related fields.

The book covers a wide range of topics, including fundamental algorithms and data structures, graph algorithms, string processing, sorting and searching, and algorithm analysis. Each topic is presented in a clear and concise manner, with numerous examples and exercises to reinforce the material.

One of the strengths of the book is its use of Java code to illustrate the algorithms and data structures. The code is easy to read and understand, and provides a practical context for the theoretical concepts being presented. In addition, the book includes numerous visualizations and animations to help readers understand the algorithms and data structures in action.

Overall, "Algorithms" is an excellent resource for anyone looking to deepen their understanding of algorithms and data structures. The book is well-written, comprehensive, and accessible, making it a great choice for both students and professionals. Whether you're studying computer science, programming, or just interested in learning more about algorithms and data structures, this book is definitely worth checking out.
Profile Image for Malachite.
50 reviews
November 16, 2021
This reminds me of my programming instructor. He explains everything line by line, making sure that we understand every statement so it would be easy for us to once we started to create our own program. I expecting a mix of programming language and I was surprised to find that it is all about Java.

I like the fact that there are Q&A, exercises and activities at the end of every duscussion. But I got to admit that some explanation although clear, left me confused. So I guess a repeat reading in the future is in order. Once I got a software where I can practice coding. Reading this without that is not a good idea in my case.
1 review
September 23, 2022
It has been quite an enjoyable experience. A bit slow paced on some really basic things. I started after my studies in CS so most of it has been just a refresh of some fundamentals.

Good if you have already some knowledge of Programming. Examples and algorithms are presented in Java but it is quite easy to follow even for non-Java programmers.

A lot of exercises are available and it opens up many possibility with creative programs and additional challenges for every topic.

It is quite remarkable that every algorithm presented in the book has a proved time and space estimation.

A must when somebody wants to start a deep dive into the details of how things work in well known API.
Profile Image for Nimrod Daniel.
143 reviews257 followers
December 27, 2016
It's a great comprehensive book about algorithms. The book contains a full implementation in java code, plus there's also a book site where you can find more code and supplemental material.
The explanations are clear and accompanied by examples that demonstrates how the algorithms work.

It's a long book, though it can be read in a very reasonable time. I was ~80% through after about a month or two (more like two I believe), but then I barely touched that for a long time.

A very informative and practical book which is highly recommended to anyone who's interested in CS.

Profile Image for Travis Davies.
2 reviews
July 31, 2022
Great book, this book is a very thorough guide to fundamental data structures. As someone with little background in programming, with the help of his free Coursera course I found the book challenging but manageable. The String section in the book is also especially interesting, learning about regular expressions and data compression algorithms.

I think I should be able to ace the algorithms uni course this semester now. 10/10 would recommend any beginner who is willing to really sit down and work through the content.
Displaying 1 - 30 of 64 reviews

Can't find what you're looking for?

Get help and learn more about the design.