Fog Creek Software
Discussion Board




sedgewick algorithms

i want to work through his series 1-5.

do you recommend the C or the C++ version, and why?

thanks!

traveler
Tuesday, February 24, 2004

It depends.  Do you plan to work with C?  Then get the C version.  C++?  Then get the C++ version.  If not sure I'd get the C++ one, even though I've only got the C version (1st edition too, blue cover).

Great book, well worth the money.

Snotnose
Tuesday, February 24, 2004

well. here are some data points:

I know C already, but have never done C++

I can just borrow the C++ one from a friend

I've heard the C++ one "isn't really C++"... it is just C sort of mildly transmogrified to compile as c++.

My ultimate goal is to write audio software (think ableton live, reason) . Which I think is C++.

I recently quit my job. I have $80,000 in my savings account. And my plan is to "do my own thing" in rural oregon.  Part of doing my own thing involves teaching myself stuff that will be useful with digital signal processing related to audio applications.

thanks!

traveler
Tuesday, February 24, 2004

IF your goal is to eventually use those skills to earn a living (either writing software or selling a product that you make with those kills) I highly recommend working toward some sort of actual deliverable, product, result, etc.

Having a realworld goal helps to balance out the theory work.

Also, if you have an actual potential customer to try the program out on, I highy recommend that as well.

I've seen a lot of software developed in isolation (from the customer) it ends up just being an academic excercise.

My $.02 worth.

Enjoy your sabbatical

The real Entrepreneur
Tuesday, February 24, 2004

I wouldn't worry about which language is used. I'm still using the Pascal version of Sedgewick, although I mostly program in C and C++. It's probably more important that the actual algorithms are useful to you - is one or other version more comprehensive or more up-to-date? You might also want to take a look at the 2nd edition of "Introduction to Algorithms" by Corman, Rivest, Leiserson, & Stein, which avoids the whole language issue by using pseudocode.

as
Tuesday, February 24, 2004

Hi, thank you for your replies.

I am not concerned about making a living. I was making a good living for 8 years as a programmer on wall street and could easily hook up with another contract in manhattan as I have a good network there. However I am uninterested in that sort of thing as i am more interested in pursuing  a simpler life in Oregon. I have no debt and my house is paid for so I could survive working as an EMT if necessary. My goal now is just to learn about stuff I should have learned in college and apply it to things I actually care about, such as music.

I just am wondering if the sedgewick is better in its C or C++ variant. Or maybe it makes no difference. I suppose I could buy both and compare them.

traveler
Tuesday, February 24, 2004

Also I should point out that I do sort of have a "goal". It is to produce a VSTi host that runs on a handheld system.

traveler
Tuesday, February 24, 2004

It might help the decision process if you took a look at the source code from both versions, which is available at:

http://www.cs.princeton.edu/~rs/

It looks to me as if the content of the two books is pretty much identical as regards the algorithms, and that the differences between the implementations are largely to do with the use of C++ features instead of corresponding C features - eg new instead of malloc, streams instead of C I/O, and so on. The C++ version looks as if it predates the standard somewhat - especially parts 1-4, which uses old style headers and hand-crafted data structures instead of the STL. You'd be wasting your money if you bought both.  I'd go for whichever, if either, is cheaper.

Good luck.

as
Tuesday, February 24, 2004

The C++ version definitely is _very_ similar to the C version. In fact I always wondered why they put out different editions anyway. I remember there was one Pseudo-Code edition, too. If a new instead of a malloc doesn't worry you too much it really doesn't matter which version you buy.

Remember, the Knuth books code is written in a special assembler and you can still "get it".

_
Wednesday, February 25, 2004

*  Recent Topics

*  Fog Creek Home