4
$\begingroup$

I am asking this question on behalf of my brother. He is taking his first programming class. So far he has just learned the basics (if-then statements, for loops, while loops, etc.)

The class is using the book Problem Solving and Program Design in C, but it's exercises are too easy. Is there a programming book or other resource that has more difficult exercises? Of course, the book doesn't have to be for C specifically, as we just need the problems.

$\endgroup$
3
$\begingroup$

Disclaimer 1: I haven't seen the book, and I have no idea what exercises it offers.

Disclaimer 2: I haven't seen your brother's code.

The goal of an easy exercise is to learn how to write the perfect code. OTOH, the beginner's code tends to be sloppy. For starters, point your brother to the Code Review exchange.

When the community is comfortable, let him go on to implement classic algorithms. Algorithms library of STL is a good starting point. When he is comfortable with it, proceed with Cormen's Introduction to Algorithms.

The next step is highly subjective. In my opinion, every programmer shall eventually work the way through Charles Wetherell's Etudes for Programmers; arguably the best collection of exercises of various toughness. I wish I had this book when I was still a student. It is not for novices though.

PS: Don't let him do Project Euler (unless he is mathematically inclined). Don't let him folow the competitive sites either.

$\endgroup$
5
  • $\begingroup$ Presumably, the book you mention is Introduction to Algorithms. $\endgroup$
    – J.G.
    Mar 20 at 23:05
  • $\begingroup$ @J.G. True, thank you. Edited. $\endgroup$
    – user58697
    Mar 21 at 1:00
  • $\begingroup$ Thank you for your answer. $\endgroup$
    – Helix
    Mar 21 at 1:54
  • 2
    $\begingroup$ Can you explain why you advise against Project Euler? $\endgroup$
    – Jasper
    Mar 21 at 13:01
  • $\begingroup$ @Jasper Project Euler is not about programming. It is about math. Usually, once you figure out the correct way to approach the problem, the programming part reduces to a one-liner. $\endgroup$
    – user58697
    Mar 21 at 17:29
6
$\begingroup$

If he wants to have a blast biting into some very fun and challenging problems, Project Euler is fantastic, and entirely language neutral.

He may find that certain problems are out of his grasp until he learns a bit more programming, but there will be many that will be possible even with what he has. (Arrays, structs, and pointers should make all of the problems accessible, even if some of them are still possibly too hard as problems before he has a good understanding of linked lists and trees.)

$\endgroup$
2
  • 6
    $\begingroup$ It has been my experience that Project Euler problems are maths problems and not so much programming problems. It's probably not a coincidence that the website is named after one of the most famous mathematicians of all time, not after a programmer. There is nothing in Project Euler that actually teaches the most important parts of programming: abstraction and reuse, and even more importantly, teamwork, communication, and documentation. $\endgroup$ Mar 20 at 7:37
  • $\begingroup$ Thanks for the answer. Looking at it, I agree with Jorg that Project Euler is for the very mathematically inclined. It's good for me though! $\endgroup$
    – Helix
    Mar 21 at 1:50
6
$\begingroup$

Although the question is asking for a book, looking a "Project Euler" mentioned in another answer, I would like to suggest Codewars might be what you are looking for. On codewars you choose your programming language and then you get different levels of problems to solve step by step. You not only test your answer with their built-in testing tool but also once correctly answered, you get to see other users answers. This is very useful because you see many different ways to solve the same problem and compare your way of doing it to others.

$\endgroup$
1
  • $\begingroup$ Thank you for your answer, this looks great! $\endgroup$
    – Helix
    Mar 21 at 1:50
5
$\begingroup$

The International Olympiad in Informatics is an international competition for gifted young amateur programmers. The tasks from past editions are available online, including detailed problem descriptions, test cases, and test harnesses.

While these tasks are described in a way that should be understandable to novice programmers, they are quite challenging and require a degree of creative thought not usually found in programming exercises.

$\endgroup$
1
  • $\begingroup$ Thank you for your answer. $\endgroup$
    – Helix
    Mar 21 at 1:54
1
$\begingroup$

Not exactly exercises, but you learn a lot about programming by working through books like Kernighan and Pike's "The practice of programming" (Addison-Wesley, 1999) and Bentley's "Programming Pearls" (Addison Wesley, 2nd edition 1999). They are not books on any language's syntax, they show how to solve though problems elegantly.

Be advised that those scoundrels have a knack of making hard problems seem almost trivial, with solutions of a couple dozen lines.

$\endgroup$
1
$\begingroup$

The book by Jeff Erickson, "Algorithms" is a (tough!) next step after getting confortable with the basics.

$\endgroup$
1
  • $\begingroup$ Thanks, will check it out. $\endgroup$
    – Helix
    May 18 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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