Free Software programmer
Subscribe This blog existed before my current employment, and obviously reflects my own opinions and not theirs. This work is licensed under a Creative Commons Attribution 2.1 Australia License.
Categories of this blog:
Older issues: |
Mon, 20 Jun 2005Solving Sudoku in C and PythonAs an intellectual exercise (I hate puzzles) I wrote a quick C program to solve sudoku puzzles. Then I wrote a Python version (almost, but not quite, "my first python program"). The python was shorter, 150 lines, vs C 260 lines. Time to code is not comparable since I am not fluent in Python, but I can believe that the Python version would have been quicker to write if I was. But hacking both versions to loop 100 times reveals the Python is about 192 times slower (oops, fixed, now 120 times slower). So it's not free. I talked to Chris about writing a C++ version (presumably using an STL Set), which would be another data point. I'd do a Z80 asm version, except I'm not sure where to get a Z80 assembler these days. [/tech] permanent link |