# Algorithm Wiki

### Site Tools

This is an old revision of the document!

# Including an algorithm in a page

An algorithm is stored in a single page in the Algorithm namespace. Different variants require different pages. For example Factorial recursive and Factorial iterative.

You include an algorithm on a different page using the algorithm tag. The title attribute is set to the title of the algorithm page.

[algorithm Fisher-Yates shuffle]

This transcludes the algorithm from Fisher-Yates shuffle.

## Creating an algorithm page

An algorithm page is split into three sections:

====== Algorithm ======
====== Support ======
====== Visualisation ======

Each of these sections contains code wrapped in <syntax> tags.

## Algorithm

The 1st section contains the algorithm. This is the code that the user sees in the interactive environment.

## Support

The 2nd section contains the support code. This is support code, such as functions that the main algorithm uses. If it also includes a run() function this function is called when running the algorithm.

## Visualisation

The 3rd section contains the visualisation code. This is a complete webpage that contains an update() function, which is called for every new line when running the algorithm. The update function takes two arguments, the current node in the AST and an execution context.