Author Topic: Books on Basic and Advanced Algorithms to program in C/C ++  (Read 11717 times)

0 Members and 1 Guest are viewing this topic.

Offline luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 592
  • Country: es
 
Hello.

I am looking for good books on Basic and Advanced Algorithms to program in C / C ++. Structures, Sorting, Search, Graphics, etc ...

Any suggestions on good books on these matters?. In my case it is for programming with microcontrollers, but I guess it does not matter, and can be applied to programming in C/C ++ on any hardware, such as PC or Raspberry as well.

At this moment I am interested in hashing/checksum  algorithms to detect low resolution images, for example using CRC32, MD5, etc...

I've been looking for Amazon, and I've selected these books for the time being, but I do not know if they're good books, and some are expensive if they do not really offer what I'm looking for.

https://www.amazon.es/gp/product/8429126627/ref=ox_sc_sfl_title_14?ie=UTF8&psc=1&smid=A1AT7YVPFBWXBL
https://www.amazon.es/gp/product/032157351X/ref=ox_sc_sfl_title_15?ie=UTF8&psc=1&smid=A1AT7YVPFBWXBL
https://www.amazon.es/gp/product/0321751043/ref=ox_sc_sfl_title_16?ie=UTF8&psc=1&smid=A1AT7YVPFBWXBL
https://www.amazon.es/gp/product/B00M0OE4GA/ref=ox_sc_sfl_title_17?ie=UTF8&psc=1&smid=AD51AJ46QU3GJ


Best Regards
« Last Edit: July 05, 2018, 10:45:44 am by luiHS »
 

Offline photovore

  • Newbie
  • Posts: 9
  • Country: de
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #1 on: July 05, 2018, 12:56:23 pm »
I enjoyed reading though "Matters Computational". Available as PDF from the authors website: https://www.jjj.de/fxt/fxtbook.pdf
 
The following users thanked this post: Kjelt, hamster_nz

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8646
  • Country: gb
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #2 on: July 05, 2018, 01:17:59 pm »
The Knuth books are considered classics, but they are quite old. The algorithms considered of high importance in the 1970s aren't necessarily the ones of high importance today. In general beware of "algorithm" books. They can be rather unfocussed, giving you a sprinkling of algorithms from different disciplines, without enough coverage of any one discipline to be very useful. Most people need books that thoroughly cover a specific area thoroughly, like:
  • A book on very low level bit and arithmetic manipulations
  • A structures, sorting, and searching book
  • A graphics book
  • An image processing book (although there are books on graphics + image processing)
  • A book on cryptography and related security areas
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #3 on: July 05, 2018, 01:31:20 pm »
Most programmers these days look on sites like stackoverflow, if you have some experience you can easily see which solutions are gold and which garbage.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8646
  • Country: gb
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #4 on: July 05, 2018, 01:44:30 pm »
Most programmers these days look on sites like stackoverflow, if you have some experience you can easily see which solutions are gold and which garbage.
I thought stackoverflow was where information went to die.  :) How often have you actually solved a problem using information from stackoverflow?
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #5 on: July 05, 2018, 01:58:08 pm »
Most programmers these days look on sites like stackoverflow, if you have some experience you can easily see which solutions are gold and which garbage.
I thought stackoverflow was where information went to die.  :) How often have you actually solved a problem using information from stackoverflow?
It was an example, more sites out there.
How often? I think perhaps 8 times or so in the last 10 years.
Mostly I use the examples/insights to code something different more suitable to my problem but it does help from time to time to see some different angles/ideas for a problem.
Discussing with colleagues can also be a great help ofcourse.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19508
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #6 on: July 05, 2018, 02:00:25 pm »
Any decent C/C++ book should include consideration of the facilities available in the different standards - because they define what you can and can't (in theory) do.

You might like to include:
Frequently Questioned Answers (sic) http://yosefk.com/c++fqa/
C Is Not a Low-level Language https://queue.acm.org/detail.cfm?id=3212479
Into the Depths of C: Elaborating the De Facto Standards https://www.cl.cam.ac.uk/~km569/into_the_depths_of_C.pdf
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #7 on: July 05, 2018, 02:20:27 pm »
I like this one: http://publications.gbdirect.co.uk/c_book/ it's mostly about C only, the language, not the libraries. And "The Unix Haters Handbook" is a good reading too, e.g.:

int main (void) {
  while (1) fork();
}
« Last Edit: July 05, 2018, 02:37:36 pm by GeorgeOfTheJungle »
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline mathsquid

  • Regular Contributor
  • *
  • Posts: 247
  • Country: us
  • I like math.
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #8 on: July 05, 2018, 02:49:59 pm »
I'd avoid the Art of Computer Programming. It's a great book, but it is very theoretical, and the implementations of algorithms are given in an assembly language that Knuth describes in the book. I don't think it would be the best way to get practical advice for writing algorithms in C.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #9 on: July 05, 2018, 03:07:23 pm »
You might consider looking for books at Alibris.com.  I get many of my older books there but every once in awhile they will have an attractive price on a new book.  OTOH, some of the sellers think their books are gold plated.

There's a huge difference between C++ on a PC where memory and speed abound and the code you might run on a small microcontroller.  I don't think the Standard Template Library (STL) is the kind of thing I would use on a uC but I would certainly use it on  a PC.  All the work for structures and methods is already done.  If I need a queue, all I need to do is say so.  Very powerful stuff!

https://www.amazon.com/C-Standard-Template-Library/dp/0134376331

Graphics is an entirely different animal.  At one level, it is all matrix algebra.  Rotate, scale and translate of graphic elements is strictly a matrix problem.  It gets more involved as you move up from the pixel level because images for video games are generally created from vertices (triangles) and you can spend a lifetime working on this idea.

https://www.google.com/search?q=game+graphics+vertices

There are a lot of books.  I would tend to sort on publication date.  Newer would be better.

I haven't done it but I understand it can be fun to use graphics cards as numeric processors.

https://www.google.com/search?q=cuda+programming
 

Offline bsfeechannel

  • Super Contributor
  • ***
  • Posts: 1667
  • Country: 00
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #10 on: July 05, 2018, 04:22:33 pm »
Has anyone mentioned "Mastering Algorithms With C" by Kyle Loudon?
 

Offline ralphrmartin

  • Frequent Contributor
  • **
  • Posts: 480
  • Country: gb
    • Me
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #11 on: July 05, 2018, 05:01:33 pm »
Sedgewick's algorithm books are excellent. I thoroughly recommend them as top books on the topic.

(For what my opinions is worth, I was a professor of computer science until I retired).
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23024
  • Country: gb
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #12 on: July 05, 2018, 06:32:15 pm »
Has anyone mentioned "Mastering Algorithms With C" by Kyle Loudon?

Excellent book but a little heavy in malloc for embedded systems.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #13 on: July 05, 2018, 07:24:48 pm »
Sedgewick's algorithm books are excellent. I thoroughly recommend them as top books on the topic.

(For what my opinions is worth, I was a professor of computer science until I retired).

Robert Sedgewick's books are all over Alibris.com and the prices are really low (mostly).
https://www.alibris.com/booksearch?keyword=Sedgewick

As an author, Sedgewick has been prolific!

Retirement is good!  I've been kicking back for 14 years.


 

Offline agehall

  • Frequent Contributor
  • **
  • Posts: 383
  • Country: se
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #14 on: July 05, 2018, 07:43:10 pm »
I'd avoid the Art of Computer Programming. It's a great book, but it is very theoretical, and the implementations of algorithms are given in an assembly language that Knuth describes in the book. I don't think it would be the best way to get practical advice for writing algorithms in C.
If you want to do more than copy&paste code into your software, that isn't a problem. Knuth will give you a fundamental understanding of what you are actually doing and how the algorithms really work. Once you understand that, implementing them in C is trivial.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #15 on: July 06, 2018, 02:55:28 am »
Quote
Sedgewick's algorithm books are excellent. I thoroughly recommend them as top books on the topic.
I second the recommendation.Also, his (free!) online classes on Algorithms are very, very good - among the best online classes I've seen.https://www.coursera.org/learn/algorithms-part1The classes are currently using Java, but ... "basic and advanced algorithms" ought to be pretty language independent.  In fact, the class FAQ says:
Quote
I have no familiarity with Java.  Can I still take this course?
Our central thesis is that algorithms are best understood by implementing and testing them. Our use of Java is essentially expository, and we shy away from exotic language features, so we expect you would be able to adapt our code to your favorite language. However, we require that you submit the programming assignments in Java.


Quote
a little heavy in malloc for embedded systems.
I do not believe that you will be able to find a book or class in algorithms that does not make heavy use of dynamic allocation.  And recursion, as well.  After you understand the algorithms in their "pure" "computer science" form, you can figure out how to remove these evil dependencies using one of the "how to appease some organization who thinks the way to avoid the large number of bugs in today's software is to write code like it was written 40 years ago" books.

 

Offline FlyingHacker

  • Frequent Contributor
  • **
  • Posts: 807
  • Country: us
  • You're Doing it Wrong
--73
 

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7547
  • Country: 00
  • +++ ATH1
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #17 on: July 06, 2018, 04:54:42 am »
The Knuth books are considered classics, but they are quite old. The algorithms considered of high importance in the 1970s aren't necessarily the ones of high importance today.

Curious about this, please share just one example.

Offline PartialDischarge

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: 00
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #19 on: July 06, 2018, 06:45:23 am »
Quote
Quote
The algorithms considered of high importance in the 1970s [in Knuth] aren't necessarily the ones of high importance today.
Curious about this, please share just one example.
These days, there are a lot more kinds of trees (and/or more tree algorithms) then there are in the original Knuth v2.  (I can't comment on the revised edition, or v3, alas.)When I was looking at Sedgewick's class, I did a lot of "how come they never mentioned this back in MY data structures class?  Oh.  It wasn't invented yet." :-(
Also, algorithms tend to be described as performing relative to the number of things being operated on:  t = k1 * f(n) + k2
To a large extent, f(n) describes how good your algorithm is, and is of much interest to Computer Scientists ("f(n) = k3*log2(n)" is SO much better than "f(n) = k3 * n3"). The k's come largely from how fast your computer is, and how well you code the algorithm (of much interest to Computer Engineers and coders.). As computers have gotten faster and n's have gotten larger, algorithms are considered, described, and implemented in ways that they wouldn't have been in the 70s (commonly using recursion and dynamic allocation being examples.)
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23024
  • Country: gb
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #20 on: July 06, 2018, 06:48:49 am »
Quote
a little heavy in malloc for embedded systems.
I do not believe that you will be able to find a book or class in algorithms that does not make heavy use of dynamic allocation.  And recursion, as well.  After you understand the algorithms in their "pure" "computer science" form, you can figure out how to remove these evil dependencies using one of the "how to appease some organization who thinks the way to avoid the large number of bugs in today's software is to write code like it was written 40 years ago" books.

Agree. The problem is that it’s virtually impossible finding anyone who actually understands that in 2018.

The right approach is to build what you need within the constraints you have and thanks to moore’s law this has given most software engineers way too much slack. We have the same problem when you have so much going on inside one physical compute node that it’s like having each thread running on a low end ARM core.
 

Offline MattSR

  • Regular Contributor
  • *
  • Posts: 95
  • Country: au
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #21 on: July 06, 2018, 06:53:17 am »
Great thread guys, I have gleaned plenty of info and suggestions!

Thanks!
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4036
  • Country: nz
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #22 on: July 06, 2018, 07:35:21 am »
Most programmers these days look on sites like stackoverflow, if you have some experience you can easily see which solutions are gold and which garbage.
I thought stackoverflow was where information went to die.  :) How often have you actually solved a problem using information from stackoverflow?

Probably 3 to 10 times a week, on average. I've been programming professionally for 33 years, but there's still plenty I don't know, especially as I continually explore new areas to learn.

Not usually for algorithms though -- I know the standard ones and am pretty good at inventing new ones. For obscure commands or options on commands, mostly.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8646
  • Country: gb
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #23 on: July 06, 2018, 08:45:19 am »
Quote
a little heavy in malloc for embedded systems.
I do not believe that you will be able to find a book or class in algorithms that does not make heavy use of dynamic allocation.  And recursion, as well.  After you understand the algorithms in their "pure" "computer science" form, you can figure out how to remove these evil dependencies using one of the "how to appease some organization who thinks the way to avoid the large number of bugs in today's software is to write code like it was written 40 years ago" books.
Agree. The problem is that it’s virtually impossible finding anyone who actually understands that in 2018.
Not really. There are a huge number of embedded developers who understand it very well. The problem is people teaching and writing books rarely understand it, or treat it as a lightweight issue of little consequence.
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23024
  • Country: gb
Re: Books on Basic and Advanced Algorithms to program in C/C ++
« Reply #24 on: July 06, 2018, 08:53:15 am »
Yeah that was the second part of my comment about Moore's Law. Prevailing attitude is "just blow things away in cycles and meh".

We have one other ex embedded guy (we are fintech sector) and everyone considers us nuts compared to the status quo :(
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf