This algorithm generates each sequence in B-order with constant average time O(1). The sequences are generated in lexicographical orders. The ranking and unranking algorithms with O(n) time complexity are also described. Finally, an algorithm for the construction of a binary tree with a linked structure from P-sequence is presented. Keywords: Binary tree, Recursion, P-sequences, B-order. |