| procedure _HamiltonianPath |
| 1: if can be stripped, where is not odd sized and then |
| 2: let be a strip of |
| 3: _HamiltonianPath |
| 4: /* is a -alphabet grid graph or a rectangular grid graph |
| */ |
| 5: HamiltonianCycle |
| 6: return MergeStrip |
| 7: else |
| 8: if can be stripped, where is odd sized and then |
| 9: let be a strip of , where is three rectangular grid graphs and |
| 10: _HamiltonianPath |
| 11: HamiltonianCycle |
| 12: HamiltonianCycle |
| 13: MergeCycles |
| 14: HamiltonianCycle |
| 15: return MergeStrip |
| 16: else |
| 17: let be split to and (or and ) |
| 18: _HamiltonianPath |
| 19: _HamiltonianPath |
| 20: return MergeSplit |
| 21: end if |
| 22: end if |