Sample Code

2001-03-27   © 2001-2003 Harry M. Hardjono ramstrong@earthlink.net

Choose Your Browser

Home Page
Work


Professional
Personal
Package
Sample Code
Opini


Word Count
Word Count
Word Count
Remove Tab
Anagram
8 Queen
Permute
Nim
Quicksort

  I have written quite a number of programs over the years. These are my sample code that I do just for fun. If you want to see what's the difference between professional and personal style, take a look at the wordcount programs. You'll see it quite clearly there. :)

  • Word Count
    Word counting program. Just like wc command. This version is the simple version in C.
  • Word Count
    Word counting program. Just like wc command. This version is the professional version in C. Note all those comments!
  • Word Count
    Word counting program. Just like wc command. This version is the simple version in Perl. I suppose I should use perl -w and use strict. Nah.
  • Remove Tab
    Remove tabs. Uses 8 space alignment by default.
  • Anagram
    Anagram. Professional style commenting. Supply your own wordlist.txt as dictionary source.
  • 8 Queen
    8 Queen problem. The greatest optimization trick actually lies in the algorithm, not some clever perl construct, such as grep below. :) You'll need to decode the output somewhat. See if you can figure out the algorithm. Take a look at my permutation code for hints.
  • Permute
    An obfuscated version of the permute algorithm. One liner and quite fast, too.
  • Nim
    Nim. Final homework assignment for Fortran class. I would make those error messages more specific, now that I know better. Take a note on the comments. I can just filter it out and provide easy documentation.
  • Quicksort
    Some people say that quicksort is very complicated. That they use bubblesort as an interim sorting algorithm since they don't want to bother thinking too much about the sort. Well, guess what? I think that quicksort isn't that difficult. In fact, it can be easier than bubble sort.