introduction to algorithms, implemented by Bash and C