How to create an algorithm

Jump to: navigation, search

Editor-In-Chief: C. Michael Gibson, M.S., M.D. [1]

Overview

An algorithm is a schematic drawing that helps organizing step by step approaches in a visually simplified way. An algorithm is formed by a set of boxes and lines that join them.

Create an Algorithm

Introduction

  • To begin an algorithm, you should start with the following code {{family tree/start}} and end it with {{family tree/end}}.
  • You can name an algorithm by starting with following: {{family tree/summary= Name of the algorithm}}
  • The algorithm consists of boxes that occupy virtual rows:
 
 
 
Box 1 in Row 1
 
 
 
 
 
 
 
 
 
Box 2 in Row 2
 
 
 
Box 3 in Row 3
 
 
 
 
 
 
Box 4 in Row 3



  • Each row is represented by the following where each | | represents a space.:

{{Family tree | | | | | | | | | }}


  • Each box is represented by the content that fills the space in | |, for example | A01 | will give:
 
A01
  • In order to link the boxes you need to use symbols. The basic symbols that you will most commonly use are the following:
    •  ! will link two boxes placed vertically on top of each other
    • - will link two boxes placed horizontally next to each other
    • ^ will link bifurcate a line arising from a box into two branches.

Algorithm Basics

Linking cells horizontally:
You type:
{{Family tree/start}}
{{Family tree | | | | A01 |-| A02 | |A01= Box 1 in Row 1| A02= Box in Row 1}}
{{Family tree/end}}
You get:
 
 
 
Box 1 in Row 1
 
Box in Row 1
 
 
You type:
{{Family tree/start}}
{{Family tree | | | | A01 |-|-|-| A02 | |A01= Box 1 in Row 1| A02= Box in Row 1}}
{{Family tree/end}}
You get:
 
 
 
Box 1 in Row 1
 
 
 
Box in Row 1
 
 
 
 
You type:
{{Family tree/start}}
{{Family tree | | | | A01 |~| A02 | |A01= Box 1 in Row 1| A02= Box in Row 1}}
{{Family tree/end}}
You get:
 
 
 
Box 1 in Row 1
 
Box in Row 1
 
 
You type:
{{Family tree/start}}
{{Family tree | | | | A01 |~|~|~| A02 | |A01= Box 1 in Row 1| A02= Box in Row 1}}
{{Family tree/end}}
You get:
 
 
 
Box 1 in Row 1
 
 
 
Box in Row 1
 
 
 
 
Linking cells vertically:
You type:
{{Family tree/start}}
{{Family tree | | | | A01 | | | |A01= Box 1 in Row 1}}
{{Family tree | | | | |!| | | | | }}
{{Family tree | | | | B01 | | | |B01= Box 2 in Row 2}}
{{Family tree/end}}
You get:
 
 
 
Box 1 in Row 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Box 2 in Row 2
 
 
 
You type:
{{Family tree/start}}
{{Family tree | | | | A01 | | | |A01= Box 1 in Row 1}}
{{Family tree | | | | |!| | | | | }}
{{Family tree | | | | |!| | | | | }}
{{Family tree | | | | |!| | | | | }}
{{Family tree | | | | B01 | | | |B01= Box 2 in Row 2}}
{{Family tree/end}}
You get:
 
 
 
Box 1 in Row 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Box 2 in Row 2
 
 
 
You type:
{{Family tree/start}}
{{Family tree | | | | A01 | | | |A01= Box 1 in Row 1}}
{{Family tree | | | | |:| | | | | }}
{{Family tree | | | | B01 | | | |B01= Box 2 in Row 2}}
{{Family tree/end}}
You get:
 
 
 
Box 1 in Row 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Box 2 in Row 2
 
 
 
You type:
{{Family tree/start}}
{{Family tree | | | | A01 | | | |A01= Box 1 in Row 1}}
{{Family tree | | | | |:| | | | | }}
{{Family tree | | | | |:| | | | | }}
{{Family tree | | | | |:| | | | | }}
{{Family tree | | | | B01 | | | |B01= Box 2 in Row 2}}
{{Family tree/end}}
You get:
 
 
 
Box 1 in Row 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Box 2 in Row 2
 
 
 
More
You type: You get:
You type: You get:
You type: You get:
Putting it together:
You type:
{{Family tree/start}}
{{Family tree | | | | A01 | | | |A01= Box 1 in Row 1}}
{{Family tree | | | | |!| | | | | }}
{{Family tree | | | | B01 | | | |B01= Box 2 in Row 2}}
{{Family tree | |,|-|-|^|-|-|.| | }}
{{Family tree | C01 | | | | C02 |C01= Box 3 in Row 3| C02= Box 4 in Row 4}}
{{Family tree/end}}
You get:
 
 
 
Box 1 in Row 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Box 2 in Row 2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Box 3 in Row 3
 
 
 
Box 4 in Row 4
 

Advanced Algorithms

Please find below an image that summarizes the symbols used in creating algorithms.

Algorithm code.png

Samples

Sample 1
You type:
{{familytree/start |summary=Sample 1}}
{{familytree | | | | | | | | A01 |A01=A01}}
{{familytree | | | | |,|-|-|-|^|-|-|-|-|.| | | }}
{{familytree | | | B01 | | | | | | | | B02 | | |B01=B01|B02=B02}}
{{familytree | | | |!| | | | | | | | | |!| }}
{{familytree | | | C01 | | | | | | | | |!| |C01=C01}}
{{familytree | |,|-|^|.| | | | | | | | |!| }}
{{familytree | D01 | | D02 | | | | | | D03 |D01=D01|D02=D02|D03=D03}}
{{familytree | |!| | | | | | | | | |,|-|^|.| }}
{{familytree | E01 | | | | | | | E02 | | | E03 |E01=E01|E02=E02|E03=E03}}
{{familytree | | | | | | | | | | |!| | | | |!| }}
{{familytree | | | | | | | | | | F01 | | | F02 |F01=F01|F02=F02}}
{{familytree/end}}
You get:
 
 
 
 
 
 
 
A01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
B01
 
 
 
 
 
 
 
B02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
C01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D01
 
D02
 
 
 
 
 
D03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
E01
 
 
 
 
 
 
E02
 
 
E03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
F01
 
 
F02
Sample 2
You type:
{{familytree/start}}<nowiki>{{familytree | | | | | | | | | A01 | | | | | |A01=A01}}
{{familytree | | | | | | | | | |!| | | | | | | | }}
{{familytree | | | | | | | | | B01 | | | | | |B01=B01}}
{{familytree | | |,|-|-|-|-|-|-|^|-|-|-|-|-|-|.| }}
{{familytree | | C01 | | | | | | | | | | | |C02|C01=C01|C02=C02}}
{{familytree | | |!| | | | | | | | | | | | | |!| }}
{{familytree | | D01 | | | | | | | | | | | |D02|D01=D01'<br>D01''|D02=D02'<br>D02''}}
{{familytree | | |!| | | | | | | | | |,|-|-|-|+|-|-|-|-|.|}}
{{familytree | | E01 | | | | | | | | E02 | | E03 | | | E04 |E01=E01|E02=E02|E03=E03|E04=E04}}
{{familytree | | | | | | | | | | | | |!| | | |!| | | | |!| | }}
{{familytree | | | | | | | | | | | | F01 | | F02 | | | F03 |F01=F01|F02=F02|F03=F03}}
{{familytree/end}}
You get:
 
 
 
 
 
 
 
 
A01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
B01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
C01
 
 
 
 
 
 
 
 
 
 
 
C02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D01'
D01
 
 
 
 
 
 
 
 
 
 
 
D02'
D02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
E01
 
 
 
 
 
 
 
E02
 
E03
 
 
E04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
F01
 
F02
 
 
F03


Sample 3
You type:
{{familytree/start}}
{{familytree | | | | | | | | | A01 | | | | | |A01=A01}}
{{familytree | | | | | | | | | |!| | | | | | | | }}
{{familytree | | | | | | | | | B01 | | | | | |B01=B01}}
{{familytree | | |,|-|-|-|-|-|-|+|-|-|-|-|-|-|.| }}
{{familytree | | C01 | | | | | C02 | | | | | C03 |C01=C01|C02=C02|C03=C03}}
{{familytree | | | | | | | | | |!| | | | | | | | }}
{{familytree | |,|-|-|-|v|-|-|-|+|-|-|-|v|-|-|-|.| | }}
{{familytree | |!| | | |!| | | |!| | | |!| | | |!| | | }}
{{familytree | D01 | | D02 | | D03 | | D04 | | D05 |D01=D01|D02=D02|D03=D03|D04=D04|D05=D05}}
{{familytree | |!| | | | | | | | | | | | | | | |!| }}
{{familytree | E01 | | | | | | | | | | | | | | E02 |E01=E01|E02=E02}}
{{familytree/end}}


You get:
 
 
 
 
 
 
 
 
A01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
B01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
C01
 
 
 
 
C02
 
 
 
 
C03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D01
 
D02
 
D03
 
D04
 
D05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
E01
 
 
 
 
 
 
 
 
 
 
 
 
 
E02


Sample 4
You type:
{{familytree/start |summary=PE diagnosis Algorithm.}}
{{familytree | | | | | | | | | | A01 | | | | |A01=A01}}
{{familytree | | | | | | | | | | |!| | | | | | | }}
{{familytree | | | | | | | | | | A02 | | | | | |A02=A02}}
{{familytree | | | |,|-|-|-|-|-|-|^|-|-|-|-|-|-|-|.| | | | | | }}
{{familytree | | | B01 | | | | | | | | | | | | | B02 | | |B01=B01|B02=B02}}
{{familytree | | | |!| | | | | | | | | | | | | | |!| | | | }}
{{familytree | | | C01 | | | | | | | | | | | | | C02 | | |C01=C01|C02=C02}}
{{familytree | |,|-|^|-|.| | | | | | | | | | |,|-|^|-|.| | }}
{{familytree | D01 | | D02 | | | | | | | | | D03 | | D04 |D01=D01|D02=D02|D03=D03|D04=D04}}
{{familytree | |!| | | |!| | | | | | | | | | |!| | | |!| | }}
{{familytree | E01 | | E02 | | | | | | | | | E03 | | |!| |E01=E01|E02=E02|E03=E03}}
{{familytree | | | | | |!| | | | | | | | | | |!| | | |!| | | | }}
{{familytree | | | | | F01 | | | | | | | | | F02 | | |!| |F01=F01|F02=F02}}
{{familytree | | | |,|-|^|-|.| | | | | | |,|-|^|-|.| |!| | }}
{{familytree | | | G01 | | G02 | | | | | G03 | | G04 |!| | |G01=G01|G02=G02|G03=G03|G04=G04}}
{{familytree | | | |!| | | |!| | | | | | |!| | | |!| |!| | }}
{{familytree | | | H01 | | H02 | | | | | |!| | | H03 |'| | | |H01=H01|H02=H02|H03=H03}}
{{familytree | | | |!| | | | | | | | | | |!| | | |!| | | | | }}
{{familytree | | | I01 | | | | | | | | | |!| | | I02 | | | |I01=I01|I02=I02}}
{{familytree | |,|-|^|-|.| | | | | | | | |!| |,|-|^|-|.| | | |}}
{{familytree | J01 | | J02 | | | | | | | |!| J03 | | J04 | | | |J01=J01|J02=J02|J03=J03|J04=J04}}
{{familytree | |!| | | | | | | | | | | | |!| |!| | | |!| | |}}
{{familytree | K01 |-|-|-|-|-|-|-|-|-|-|-|'| |!| | | K02 | |K01=K01|K02=K02}}
{{familytree | |!| | | | | | | | | | | | | | |!| | | | | | |}}
{{familytree | |`|-|-|-|-|-|-|-|-|-|-|-|-|-|-|'| | | | | | |}}
{{familytree/end}}
You get:
 
 
 
 
 
 
 
 
 
A01
 
 
 
 
 
 
 
 
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
K01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
K02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Sample 5
You type:
{{familytree/start |summary=PE diagnosis Algorithm.}}
{{familytree | | | | | | | | | |,|-| A01 |-| A02 | | | |A01= |A02= }}
{{familytree | | | | | | | | | |!| | | | | | | | | | | | | | | | | | }}
{{familytree | | | | | | | | | |)|-| B01 |-| B02 | | | |B01= |B02= }}
{{familytree | | | | | | | | | |!| | | | | | | | | | | | | | | | | | }}
{{familytree | | | | | | C01 |-|+|-| C02 |-| C03 | | | |C01= |C02= |C03= }}
{{familytree | | | | | | | | | |!| | | | | | | | | | | | | | | | | | }}
{{familytree | | | | | | | | | |)|-| D01 |-| D02 | | | |D01= |D02= }}
{{familytree | | | | | | | | | |!| | | | | | | | | | | | | | | | | | }}
{{familytree | | | | | | | | | |`|-| E01 |-| E02 | | | |E01= |E02= }}

{{familytree/end}}
You get:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Sample 6: Alignment and Bulleting
You type:
{{familytree/start |summary=Sample 6}}
{{familytree | | | | | | | | A01 |A01=A01}}
{{familytree | | | | |,|-|-|-|^|-|-|-|-|.| | | }}
{{familytree | | | B01 | | | | | | | | B02 | | |B01=B01|B02=B02}}
{{familytree | | | |!| | | | | | | | | |!| }}
{{familytree | | | C01 | | | | | | | | |!| |C01=C01}}
{{familytree | |,|-|^|-|.| | | | | | | |!| }}
{{familytree |boxstyle=text-align: left; | D01 | | D02 | | | | | | D03 |D01=• A<br>• B<br>• C<br>• D|D02=• E<br>• F<br>• G<br>• H|D03=• I<br>• J<br>• K<br>• L}}
{{familytree | | | | | | | | | | | |!| | | |!| }}
{{familytree | E01 | | | | | | | | E02 | | E03 |E01=E01|E02=E02|E03=E03}}
{{familytree | | | | | | | | | | | |!| | | |!| }}
{{familytree | | | | | | | | | | | F01 | | F02 |F01=F01|F02=F02}}
{{familytree/end}}
You get:
 
 
 
 
 
 
 
A01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
B01
 
 
 
 
 
 
 
B02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
C01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
• A
• B
• C
• D
 
• E
• F
• G
• H
 
 
 
 
 
• I
• J
• K
• L
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
E01
 
 
 
 
 
 
 
E02
 
E03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
F01
 
F02

Linked-in.jpg