Average-case analysis of equality of binary trees under the BST probability model
In this paper a simple algorithm to test equality of binary trees currently used in symbolic computation, unification, etc. is investigated. When the uniform probability model for the input is assumed, it is well known that it takes O(1) steps on average to decide if the trees in a given pair of total size n are equal or not. The aim of the paper is to analyze this average complexity when the so-called bst probability model is assumed. The analysis is itself more complex although feasible, involving the solution of partial differential equations and singularity analysis of Bessel functions. Nevertheless, since partial differential equations are generally unsolvable, like the one which is derived from the bivariate recurrence for the equality, an indirect mechanism solving a simpler equation and showing asymptotic equivalence of solutions is used to obtain the main result : testing equality of a pair of binary trees of total size n and distributed accordingly to the bst probability model is ⊝(logn) on the average.
Unable to display preview. Download preview PDF.
- [AS64]M. Abramowitz and I.A. Stegun. Handbook of Mathematical Functions. Dover Publications, New York, 1964.Google Scholar
- [BCDM91]R. Baeza, R. Casas, J. Díaz, and C. Martínez. On the average size of the intersection of binary trees. SIAM Journal on Computing, 1991. To appear. Also available as Tech. Rep. LSI-89-23, LSI-UPC, Nov 1989.Google Scholar
- [CDS89]R. Casas, J. Díaz, and J.M. Steyaert. Average-case analysis of Robinson's unification algorithm with two different variables. Information Processing Letters, 31:227–232, June 1989.Google Scholar
- [CFS90]R. Casas, M.I. Fernández, and J.M. Steyaert. Algebraic simplification in computer algebra: an analysis of bottom-up algorithms. Theoretical Computer Science, 74:273–298, 1990.Google Scholar
- [CH62]R. Courant and D. Hilbert. Methods of Mathematical Physics, volume 2. InterScience J. Wiley, 1962.Google Scholar
- [Cop75]E.T. Copson. Partial Differential Equations. Cambridge University Press, Cambridge, 1975.Google Scholar
- [Fel71]W. Feller. An Introduction to Probability Theory and its Applications, volume 2. J. Wiley, New York, 1971.Google Scholar
- [GJ83]I. Goulden and D. Jackson. Combinatorial Enumerations. J. Wiley, New York, 1983.Google Scholar
- [Inc56]E.L. Ince. Ordinary Differential Equations. Dover Publications, New York, 1956.Google Scholar
- [Knu73]D.E. Knuth. The Art of Computer Programming: Sorting and Searching, volume 3. Addison-Wesley, Reading, Mass., 1973.Google Scholar
- [SF83]J.M. Steyaert and Ph. Flajolet. Patterns and pattern-matching in trees: An analysis. Information and Control, 58, 1–3:19–58, 1983.Google Scholar
- [VF90]J.S. Vitter and Ph. Flajolet. Average-case analysis of algorithms and data structures. In Jan Van Leeuwen, editor, Handbook of Theoretical Computer Science, Vol. A, pages 410–440. North-Holland, 1990.Google Scholar