Optimal Insertion in Two-Dimensional Arrays

Abstract An algorithm for finding binary insertion trees for M × N two-dimensional arrays from one-dimensional optimal insertion trees is proposed. New theorems that apply to the one-dimensional optimal insertion trees are presented, and a bound on the cost of two-dimensional binary insertion trees is found. The proposed algorithm uses a fast O(n log n) algorithm on (M+N+2) one-dimensional arrays and the results of the presented theorems to determine the root of the two-dimensional insertion tree. The algorithm is repeated successively on each of the two resulting two-dimensional arrays to determine the left and right subtrees. The algorithm is easy to implement and yields optimal trees for some special two-dimensional arrays and close to optimal trees for arbitrary arrays.