Generating Ordered Trees

A new algorithm for generating all ordered trees on n nodes, is developed. It is a nonrecursive algorithm which, without any assistance of codewords or any other combinatorial representation, directly generated all trees on n nodes, in average time O(1) per tree. The algorithm transforms one tree into another in the following way: it finds a unique transforming node x and performs one node degradation operation, followed optionally by one path compression. The average length of path to be compressed is less than 1126. There is a coding of trees in which the algorithm produces trees in the lexicographic order.