Balanced binary tree code for scientific applications

S. C. Park, Louisiana State University
J. P. Draayer, Louisiana State University


A set of easy-to-use FORTRAN routines for building and accessing data structures of the type commonly encountered in scientific applications is introduced. Fetch and insert times go as ≻ [log (n)], where n is the number of elements in the list. The routines implement AVL or height-balanced binary tree logic. Each tree is a linear integer array. The first ten elements of a tree array specify its structure and the remaining elements are dedicated to node information. Each node includes key and integer data elements in addition to the necessary linkage information. The keys and data can each be multiple word entries. The routines are generic so even though the structure of any one specific tree is fixed, an application can include several trees that have different structures with no additional code requirements. An example that illustrates how the application can be integrated into an existing code is included. © 1989.