I was looking around for some good exercises to make the Linked List learnings I've been doing stick (reading "Mastering Algorithms with C"). After a search on Google I found Stanford's LinkListProblems.pdf. It was pretty helpful and fun. These are my solutions to those.
To build using Rake, you will need Ruby, Rubygems and the Rake gem installed. If you have a Mac with Leopard or Snow Leopard on it, you already have what you need.
rake SOURCE_FILE_WITHOUT_EXT
To build an individual solution where the output binary has the same basename of the source file. Like:
rake 15-mergesort-test
./15-mergesort-test
Or to build them all:
rake all
The Rake task's are just a thin layer on the following:
gcc -c -o src/linked-list-problems.o src/linked-list-problems.c
gcc -o OUTPUT_BINARY src/SOURCE_FILE src/linked-list-problems.o
Like:
gcc -c -o src/linked-list-problems.o src/linked-list-problems.c
gcc -o 15-mergesort-test src/15-mergesort-test.c src/linked-list-problems.o
- Redo solutions with different linked list implementations, probably closer to what's in "Mastering Algorithms in C"
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.