simple regex parser

From http://www.geeksforgeeks.org/forums/topic/implement-a-regular-expression-parser/: implement a simple regex parser. This is a brute force O(n2) solution that may have some rough edges, but works for most cases: …

Read full post

print an n-dimensional array in c

Some tricky pointer arithmetic. Turns out a really easy optimization if order doesn't matter much is to treat it like a single dimentional array of length d1 x d2 x d3 ... dn where d1 is the first dimention, etc. These two expressions are exactly equivalent in the way the memory…

Read full post