Category Archives: C Programming Challenges

Polynomial multiplication

This is is the first C programming challenge on the site and is about writing memory efficient C code.

  • Download the source code for polynomial multiplication here.
  • First implement the missing functions declared in poly.h and type make. The correctness of your code for the sample input will then be checked using diff.
  • Then try to make your code as memory efficient as possible for a 32-bit Power computer. The memory size is counted as static memory used by poly.o i.e. excluding stack and heap memory but you need to use the heap since the tested input will have arbitrary size at the grading server. Memory leaks are detected and forbidden. You are only allowed to use at most 4 times as much heap memory as my reference implementation for the random input tested at the server. The maximum stack size is reduced by the grader before running your program.
  • Mail your poly.c solution to cbook@forsete.net with subject line: assignment poly by username where username is alphanumeric (with dot and underscore allowed). No registration is required and everyone is welcome to submit solutions.
  • If your code passes the tests, you will get a score back (in the reply mail subject line as well as in a file).
  • The high score list with the 10 best scores is here.
  • My (i.e. Jonas’) submission is a relatively straight forward reference implementation (username ref and domain forsete.net) with 735 bytes — can you beat that? 🙂