exercises

coding exercise with example solutions

I'm looking for coding exercises that have solutions. I've checked out topcoder and codekata but neither seem to have user posted solutions (maybe I just can't find them?). Basically I can (try) to figure out how I would solve a problem but what I want is to learn and expand my knowledge by see how other (better) coders would solve t...

Recommend an algorithms exercise book?

I have a little book called Problems on Algorithms by Ian Parberry which is chock full of exercises related to the study of algorithms. Can anybody recommend similar books? What I am not looking for are recommendations of good books related to algorithms or the theory of computation. Introduction to Algorithms is a good one, and of co...

good book about PHP with good exercises

Is there any book about modern PHP (like 5.2 + mysqli or PDO) for beginners with good exercises (for ex., good exercises are in "Learning Perl", which is one of the best books for beginners)? P.S. (considering some answers I got on IRC): it should not be a tutorial, it should not be a video tutorial, it should not be outdated (like usin...

Games for learning

I often find myself wasting a lot of time playing short games like Mine Sweeper or Solitaire in between my studying. I am looking for a better habit to replace this one. I have learned a lot by solving problems from programming competitions, an activity which has a certain instant gratification / short feedback-loop quality to it. The l...

What's the explanation for Exercise 1.4 in SICP?

I'm just beginning to work through SICP (on my own; this isn't for a class), and I've been struggling with Exercise 1.4 for a couple of days and I just can't seem to figure it out. This is the one where Alyssa re-defines if in terms of cond, like so: (define (new-if predicate then-clause else-clause) (cond (predicate then-clause) ...

Emacs exercises to become more comfortable and familiar with the editor itself as well as Lisp?

There's a great project called the Ruby Koans, it's a series of tasks to exercise yourself in the Ruby language, stepping you through the standard library using the Ruby Unit Testing suite as a learning tool. It's a great project. I'd love to see something similar for Emacs. Can anyone recommend any Lisp exercises to be done inside ...

How to use the APT tool to create exercises in course material

I'm in the process of creating exercises in how to write a plug-in to a system integration tool. We will have the correct answers implemented for demonstration after exercises, but the students will receive source where some methods are empty and just have a comment with a TODO in them describing what they should do. To avoid duplicati...

Debugging exercises

Is there something like Project Euler, but with each task consisting of a broken program which you have to fix? So one can improve debugging skills. Where you can post your improved version, and it checks if your fixed version of the program works correctly (and possibly that you haven't just totally rewritten). Perhaps also a spoiler pa...

ruby oop practice problem and solution set for beginners

I need a set of ruby problems + solutions that require solutions involving more than a few interacting classes. The point is to teach OOP in ruby to a beginner. Sites like rubyquiz tend to have problems that require clever algorithms, rather than OOP design. The best I can think of so far is to do a very simple game like pong, but Rub...

Functions to compress and uncompress array of integers

Hi all I was recently asked to complete a task for a c++ role, however as the application was decided not to be progressed any further I thought that I would post here for some feedback / advice / improvements / reminder of concepts I've forgotten. The task was: The following data is a time series of integer values int timeseries[32]...

How many different ways are there to concatenate two files line by line using Perl?

Suppose file1 looks like this: bye bye hello thank you And file2 looks like this: chao hola gracias The desired output is this: bye bye chao hello hola thank you gracias I myself have already come up with five different approaches to solve this problem. But I think there must be more ways, probably more concise and more elega...

Resources/Exercises to do when learning a new language

I was looking around SO to find some exercises or interesting problems to do when learning a new language. Mostly of the time learning a language directly from reading the book does not work, even when a book tries to make an application from scratch to end. Besides Code Kata, 15 Exercises to know... and Project Euler what are some ot...

where is the best algorithm exercises like euler project?

i need learn algorithm... ...

What topics and exercises would you recommend be covered in an iPhone bootcamp?

I attended an iphone bootcamp in early '08 and have TA'd a few since. I've recently been asked to teach one and I'm curious what YOU would want to be covered. Keep in mind, the class is 3x days (8 hours each day, minus 1hour for lunch) My WIP list currently is: Introduction to the iphone hardware ' ' ' development environment Debugg...

Stack vs. heap storage

This program sorts input lines lexicographically, and I've come to this exercise in K&R: Rewrite readlines to store lines in an array supplied by main, rather than calling alloc to maintain storage. How much faster is the program? The original program is the same, just it used alloc to maintain storage for lines. So I edited it th...

Modify detab to accept list of tab stops

This is my version of detab, from this K&R exercise: Modify detab to accept a list of tab stops as arguments. Use the default tab setting if there are no arguments. #include <stdio.h> #include <stdlib.h> #define TAB_STOP 8 /* replaces tabs from input with the proper amount of blank spots */ int Detab() { int c, x; int co...

Dragon Book - answers?

Hey guys, I went out and bought a copy of the Dragon Book (second edition) but most of the exercises don't seem to have answers. Any idea where I can get them? Edit: Couldn't find solutions anywhere. Also, further research revealed that the gradiant quesions/answers do not match those in the book. Therefore you guys will probably see ...

No idea how to solve this SICP exercise

This is not homework. Exercise 1.11: A function f is defined by the rule that f(n) = n if n<3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n> 3. Write a procedure that computes f by means of a recursive process. Write a procedure that computes f by means of an iterative process. Implementing it recursively is simple enough. Bu...

What sorts of things should I build when teaching myself a new language?

Possible Duplicates: Projects for learning a new language What would you write if you wanted to learn a new language? I'm a rather junior programmer. I did a program in college on programming, so I've been exposed to a bunch of different languages (C++, Java, VB.Net, even COBOL) and I understand the basic concepts of buildin...

What is a good standard exercise to learn the OO features of a language?

When I'm learning a new language, I often program some mathematical functions to get used to the control flow syntax. After that, I like to implement some sorting algorithms to get used to the array/list constructs. But I don't have a standard exercise for exploring the languages OO features. Does anyone have a stock exercise for this...