Some sample iterative and recursive algorithms