Puzzle: Counting Triangles

An algorithm starts with a single equilateral triangle and on each subsequent iteration adds new triangles all around the outside. The results for the first three values on n are shown in the image above. How many small triangles will be there after the nth iteration?

Advertisements

Wolf, Goat, Cabbage

The classic puzzle and one with a twist – all solved with diagrams and explanations...

Sorting Algorithms

A sorting algorithm puts a list of elements in a particular order. In python, if you want to sort a list, you can do list.sort(), however, here we will explore how to create our own sorting function.

Create a free website or blog at WordPress.com.

Up ↑