Skip to content
HomeVideosBooks
AllTopicsTrends
BlogsPodcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    Cover of Mastering algorithms with C

    Mastering algorithms with C

    Kyle Loudon, Andy Oram · 1999

    Theoretically underpins families of basic algorithms, and then presents working C code.

    ProgrammingComputer Science
    Open LibraryAmazon
    Stats for nerds
    3recommend
    9mentions
    9people
    2010–2020years
    33% recommend67% neutral

    Mentions per year

    201020122014201620182020

    What Hacker News says

    1. CanadaJun 2015
      I enjoyed Mastering Algorithms With C. After going through that book I was able to actually get things done. I recommend this because it walks through the implementation of basic data structures that you will be working with no matter what you're doing.

      K&R is a good reference, but I only found it useful after I knew enough to actually get things done. I didn't find it good to learn with, and I was already proficient in a couple of scripting languages.

      I also recommend Richard Stevens books. Advanced Unix Programming and Unix Network Programming are excellent. I'm not sure what you want to work on, so that might not be relevant.

      For studying how non-trivial things are implemented I like TCP/IP Illustrated Volume 2, and The Design and Implementation of the Freebsd Operating System.

      One of the things you're going to find about C that's different from higher level languages is that it's so minimal that you're going to have to build up a personal library of code to get things done.

      For code samples, I like to look at OpenBSD. It's all in one place and there's less cruft than most of the alternatives. This is useful because while the key tasks of a particular program might be described well in one of the books I mentioned, it's not the same as a real modern program. I've found it really helpful to actually look at something that's stood the test of time for inspiration. Also, it's man pages are awesome. I look at them often even when writing code on other operating systems.

      And remember, valgrind is your friend.

      thread
    2. fslothApr 2014
      Like others, I would suggest K&R. Perhaps after that, Lourdon's "Mastering algorithms with C". I've found that structuring any program around well understood datastructures and keeping it KISS after that takes you a very long way. Also applies to C. Like others have commented, stylistically the code in the linked book is perhaps not the best place to learn the best conventions for C. But! Writing an interpreter gives a huge kick and reading other peoples code is always nice.

      For real world projects, it's not a bad idea to implement your own memory manager (even if it's only a wrapper for malloc and free). For real world interpreters Lua (www.lua.org) is written in C, is quite widely used and is not too large - if interpreters are your interest. If you are into lisps Structure and Interpretation of Computer Programs http://mitpress.mit.edu/sicp/full-text/book/book.html contains a the instructions for writing a lisp interpreter in any language.

      thread
    3. 1331Mar 2010
      I highly recommend _C: A Reference Manual_ by Harbinson and Steele. It has many tiny examples, but it is mainly used as a reference manual (as the title suggests).

      http://www.amazon.com/Reference-Manual-Samuel-P-Harbison/dp/...

      A good book for learning C is _Mastering Algorithms with C_ by Loudon. The source code is over-commented and contains too much white space, which is a bit annoying, but the content is quite nice.

      http://www.amazon.com/Mastering-Algorithms-C-Kyle-Loudon/dp/...

      thread
    4. glouwbugOct 2020
      The alternative would be to rely on void* for all data types, which was really nicely presented in Mastering Algorithms with C by Kyle Loudon, but after working through it the lack of type safety for even basic types was a huge pain.

      At least with a bit of pre-processor magic, type safety and contiguous data is promised. Also, getting crafty with precompiled headers, one could dump all the expansions into a single templates.h, compile a .gch, and reap the benefits of hundreds of containered types with instantaneous compile times.

      thread
    5. epakaiOct 2019
      Most algorithms books take time to explain data structures. They are very intertwined topics. CLRS has 2/7 main sections dedicated to data structures and makes a fine reference, but it's also a lot of pseudocode and is quite in-depth. "Mastering Algorithms with C" is split nearly 50/50 between them and has real code examples though I don't care for the coding style.

      My personal preference has been Sedgewick's "Algorithms in C" which introduces elementary structures first and more advanced ones with their algorithms. Sedgewick's latest "Algorithms" has Java code if you prefer, and it still rates well.

      thread
    6. jetsnocDec 2011
      Thank you for the excellent book suggestion. I've only been writing in C for a few years now. I've been grappling for a better way to manage and abstract some of our utilities in our poorly written legacy application. Every linked list is custom, and every array malloced and freed on the fly -- it's so fragile that sometimes I feel paralyzed. It's been terribly wrong for a long time but I've personally lacked the experience and formal training to make it better through libraries and wrappers. About a year ago I picked up "Mastering Algorithms with C" and it was very helpful at teaching complex algorithms but never really helped me abstract our code base in to something portable and reusable.

      I'm certain this book will help me tremendously. :P

      thread

    Related

    Cover of Code Complete
    2007–2026

    Code Complete

    Steve McConnell
    393 recommend · 894
    Cover of Introduction to Algorithms
    2007–2026

    Introduction to Algorithms

    Thomas H. Cormen
    274 recommend · 880
    Cover of Expert C programming!
    2008–2026

    Expert C programming!

    Peter Van der Linden
    88 recommend · 150
    Cover of The C Programming Language
    2007–2026

    The C Programming Language

    Brian W. Kernighan
    246 recommend · 604
    Cover of The algorithm design manual
    2007–2026

    The algorithm design manual

    Steven S. Skiena
    195 recommend · 321
    Cover of C programming
    2009–2025

    C programming

    K. N. King
    26 recommend · 33
    Cover of The art of computer programming
    2007–2026

    The art of computer programming

    Donald Knuth
    recommend · 1,799
    336
    Cover of Programming in C
    2010–2016

    Programming in C

    Stephen G. Kochan
    7 recommend · 9