I am really interested in diving into leetcode. However, I want a solid foundation on data structures and algorithms being used to solve the problems in Leetcode. Please recommend to me some books/resources which would help me. Thanks

  • 1
    $\begingroup$ What makes you think you need a book before starting? All topics are tagged, so you can pick basic problem, work up to harder problems, and search for particular concepts as you need them. Algorithms and data structures are huge topics, so starting with the book may result in a lot of extra information that's hard to see the purpose of. $\endgroup$
    – ggorlen
    Jul 16, 2022 at 19:55

1 Answer 1


Cormen's, Leiserson's, Rivest's and Stein's Introduction to Algorithms and Data Structures is widely considered a most great book on the topic in question.

Even when googling "best algorithms and data structures book", first few links place it at the top of their lists. Some even mention that it's sometimes called "the bible of algorithms".

That book covers not only the basics, but also topics above the "standard" level of Leetcode exercises. I highly recommend starting with it. After you finish it, I believe the best course of action is to reserach individual topics that cought your interest.

There is one more thing I would like to touch on. A mistake some people make is trying to read those kind of books from cover to cover and only afterwards jump into coding. This approach is, most of the time, very inefficient. Once you learn an algorithm or a data structure, try using it, implementing it, and tweaking it. Experiment with the knowledge you are gathering on your way, rather than trying to isolate it.

  • 1
    $\begingroup$ I am looking for something other than Cormen's Introduction to Algorithms and Data Structures. I heard it reads like a dictionary for algorithms and data structure. I want something lighter and more fun to read. Do you have any recommendations or should I just man it up and go with Cormen's? $\endgroup$ Jul 11, 2022 at 13:50
  • 2
    $\begingroup$ Unfortunately I am not aware of a ADS (algorithms and data structures) book that is primarily aiming to be as light as possible. ADS is a technical topic very close to mathematics. You may find more luck by looking for courses rather than books given your criteria. $\endgroup$
    – Fureeish
    Jul 11, 2022 at 14:38
  • 1
    $\begingroup$ @NazmusSaqueebAshrafi If you are looking for entertainment I'm sure you can find lighter explanations. I.e. all search algorithms have corresponding dance videos like youtube.com/watch?v=lyZQPjUT5B4, but as Fireeish pointed out this is a topic that requires effort and it is very unlikely you can learn it without your own work irrespective what media (books, videos or lectures, audio-books, comics) work for you to study. $\endgroup$ Jul 11, 2022 at 18:56
  • 3
    $\begingroup$ " I heard it reads like " You mean you're dismissing it without actually looking at it? $\endgroup$ Jul 11, 2022 at 20:25
  • 1
    $\begingroup$ @VictorEijkhout No not being dismissive, just looking for a different approach. I was just looking for a different approach/take to algorithms than Cormen. $\endgroup$ Jul 15, 2022 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.