| Algorithm 1. Given an m-tuple of elements from a totally ordered set X, a distinct numerical representation of its ordinal pattern of order m can be obtained as outlined by the following pseudocode. |
| 1 function encode_pattern 2 input 3 with 4 output 5 n 6 begin 7 8 for to do 9 for to m do 10 11 end 12 13 end 14 return n 15 end. |