News for hackers. Stuff that matters.
Re:Best algorithms book I ever read by lawnchair_larry on Monday August 22, 2011 @09:00PM (#2914845)
> The only caveat here is that most of the examples are written in C, which can be troublesome if you don’t know or have forgotten about pointers.

It is hard for me to take advice seriously from someone who says this.

Re:Best algorithms book I ever read by losvedir on Monday August 22, 2011 @09:10PM (#2914871)
I bought this book on Yegge's recommendation as well, and this actually was a stumbling block for me at first.

"Whyyy is this variable, ★★p a pointer to a pointer?! p is never referenced in the function, so why are we two levels of indirection down?!" I didn't realize at the time that pointers are copied by value in C, so in order to modify the pointer you need to give the function a pointer to it.

I guess it was worthwhile, though, because it encouraged me to play around with C[1] a bit in order to grok it.

P.S. Sorry for those stupid stars, HN kept eating my highlights. Any way to avoid that?

[1]https://gist.github.com/661564

Re:Best algorithms book I ever read by michaelcampbell on Monday August 22, 2011 @09:34PM (#2914955)
Indent your "code" with a few spaces.

    int **p; /* I used 4 spaces in front of "int" */
Re:Best algorithms book I ever read by losvedir on Monday August 22, 2011 @11:22PM (#2915202)
Ah, thanks. I was hoping there was an inline way, but I guess this will have to do.
Re:Best algorithms book I ever read by tedunangst on Monday August 22, 2011 @11:15PM (#2915186)
um, why? It seems perfectly reasonable to me that examples written in C could be troublesome to someone who doesn't know C.
Re:Best algorithms book I ever read by ntoshev on Tuesday August 23, 2011 @02:35AM (#2915608)
I don't think anyone can forget pointers though, except in Winnie the Pooh way.

Also, anyone learning data structures should know pointers or at least references as a prerequisite. You can't reason about efficiency in data structures knowing only the high level comfort of Python.

Re:Best algorithms book I ever read by pbreit on Tuesday August 23, 2011 @12:39AM (#2915369)
I think it's a reasonable caveat and don't find its inclusion undermining the OPs main thrust.