Programming

This page will link to programming examples and expositions.

Programmers Rules

Know your Goal
What is it that the program is supposed to do? If you can't express the goal of the code, then you can't design or build it. Get a clear understanding of the purpose of the code and the results it is supposed to generate before you try to build it.
Know your Data
If the data can't support your processing, it won't matter how much smarts you put into the code.
Write to a narrative
In plain language, describe each component's operation. Use that narrative to guide you in writing the corresponding code.
Subdivide and Conquer
When a component's description becomes too complex to follow, break that component up into simpler tasks, and describe each task. When the descriptions become simple enough (but no simpler) to follow, write your code.

Computing e

Introduction

One of the things computers are useful for is computing large (and small) numbers. The number called e is the base of natural logarithms, and is one of those "transcendental numbers".

Page: 

Generating Mazes

Introduction

recursion
noun See recursion
Page: 

Word counting using a binary tree dictionary

Introduction

In "The C Programming Language", the authors present an example program that counts unique words in a text. Such a program needs to maintain a list of every unique word encountered, and for each word, an associated count of the number of occurrences.

Page: 

Finding the number of digits in N!

A quick bit of code to find the number of digits in N!

The number of digits in a number X = CEILING[log(X)]
and N! = (N * N-1 * N-2 ... * 1)
Thus, the number of digits in N! = CEILING[log(N!)]
Page: