Modelling and Simulation in Engineering

Volume 2014 (2014), Article ID 748941, 5 pages

http://dx.doi.org/10.1155/2014/748941

Research Article

On Counting and Embedding a Subclass of Height-Balanced Trees

Indhumathi Raman

School of Information Technology and Engineering, VIT University, Vellore 632014, India

Received 7 February 2014; Revised 5 May 2014; Accepted 5 May 2014; Published 26 May 2014

Academic Editor: Aiguo Song

Copyright © 2014 Indhumathi Raman. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract.

A height-balanced tree is a rooted binary tree in which, for every vertex , the difference in the heights of the subtrees rooted at the left and right child of (called the balance factor of ) is at most one. In this paper, we consider height-balanced trees in which the balance factor of every vertex beyond a level is . We prove that there are such trees and embed them into a generalized join of hypercubes.

1. Introduction

The problem of efficiently implementing parallel algorithms on parallel computers has been studied as a graph embedding problem, which is to embed the communication graph (underlying a parallel algorithm ) within the network topology of a parallel computer with minimum communication overhead. The working of the parallel algorithm when implemented on can be described by embedding into . Mathematically, an embedding of a (guest) graph , into a (host) graph , is a one-one function such that if , is an edge in , then and are connected by a path in . We use and analogously. The following are two of the parameters that measure the quality of an embedding.

(i). By we mean the shortest distance between and in graph . The dilation of an embedding measures the maximum time required to route a message in the host graph, between any two vertices. If dilation, then is isomorphic to a subgraph of and we write . If dilation, then in this paper we denote it by .(ii).This parameter measures the relative number of unutilized processors in the host graph. Since is a one-one function, expansion is at least .

A goal of a parallel algorithm designer is to map (or embed) the algorithm graph into an interconnection network with dilation and expansion kept as minimum as possible. However, for most embedding problems, it is very difficult to obtain an embedding that minimizes these parameters simultaneously. Therefore, some tradeoffs among the parameters must be made; see Leighton [1].

Trees generally form the underlying data structure for several parallel algorithms that employ divide-and-conquer rule, branch-and-bound technique, and so on. A self-balancing binary search tree that ensures a logarithmic running time (in both average and worst case) on operations such as insertion, deletion, and rotation, regardless of the order of the data inserted, is a height-balanced tree. Insertions and deletions may require the tree to be rebalanced by one or more tree rotations. However, these rotations take constant time. The height-balanced trees are also called AVL trees, named after their inventors Adelson-Velskii and Landis [2], and their computational aspects are discussed in [3–5]. The computational efficiency of height-balanced data structures has motivated a vast study in parallel computations too. They have been used for concurrent search, concurrent insertion, and information storage and retrieval and implement parallel dictionary routines; see [4–7]. A formal definition of height-balanced trees is given in the next section.

On the other hand, among the interconnection networks of parallel computers, the binary hypercube has received much attention. An n-dimension hypercube (denoted by ) has vertices each labelled with a binary string of length and two vertices are adjacent if and only if their labels differ in exactly one position. The hypercube topology has several attractive features. Its popularity is due to the fact that the nodes of a hypercube are symmetrically placed and the number of interprocessor connections per node is small. Another important property of a hypercube is its ability to efficiently simulate the message routings of other interconnection networks. An extensive survey of embedding various graphs into hypercubes is given in [1, 8–10].

In this paper, we consider a subclass , of height-balanced trees and we analyse the size of the subclass by counting the number of trees in it. We also prove that every height-balanced tree , is embeddable in a generalized join of hypercubes with dilation .

2. Preliminaries

Definition 1. A rooted binary tree is said to be height-balanced if, for every vertex , the heights of the subtrees, rooted at the left and right child of , differ by at most one.

A classical example of a height-balanced tree is the complete binary tree. Figure 1 shows a few small height-balanced trees.

Figure 1: Examples of height-balanced trees.

In this paper, without loss of generality, we assume that the height of the left subtree is not less than the height of the right subtree for every . With any height-balanced tree , we associate a function , defined by the difference between the heights of left and right subtrees of , for every vertex . This difference is called the balance factor of . The balance condition, being binary, ensures that the height of a height-balanced tree is logarithmic of its size; refer to [11].

It is usually assumed that the height of an empty tree is and that of a single-vertex tree is . Consequently, for a leaf , . Clearly,

If is a height-balanced tree of height , we denote its levels by , , where . It is shown in [2] that the

Let where denote the subclass of height-balanced trees with height such that

So . While contains only one element, namely, the complete binary tree of height , is the class of all height-balanced trees of height . Let be the th vertex from left at level ; then it follows from (1) and from the definition of that

By (2) and (4), the number of vertices in , for , is

3. Counting Trees of HB

Theorem 2. The class of height-balanced trees contains exactly trees.

Proof. The idea of the proof is to establish a one-to-one correspondence between and . That is, for every , we will prove that there exists a sequence , such that , and vice versa.

We first assume the existence of a tree and associate an element of to . Given the tree , we order the vertices of according to the breadth first search (BFS), say, . For , let . Then the sequence is the required sequence.

We next prove the converse. For a given sequence of ’s and ’s, we construct a tree (Figure 2) such that (1) and (2) as follows. Consider a complete binary tree of height . Let denote the th leaf (where ) from left in level . For every , we root a complete binary tree to (i.e., becomes the root of ). The height of is calculated as follows:

where

Claim 1 ( ). From (6), we note that . Therefore, the height of is height of . In , for all , every vertex is a vertex of some . Hence, for all . This implies that .

Claim 2 (for and , ). Let denote the subtree rooted at the vertex of . Hence by definition, the balance factor of the vertex is the difference between the heights of the left subtree and the right subtree of . That is,

Let and denote the integers and , respectively. Since the subtree rooted at a vertex in level is a complete binary tree, we have and and . In order to calculate the difference , we consider two cases.

Case ( ). On rewriting the values of and we have and . We note that the greatest powers of that divides and are and . Hence, by following (6), we have and , , and then,

Case ( ). In this case, and . Since is even, and

Hence in both cases, . We have proved the claims and hence the theorem.

Figure 2: , . The circles represent the vertices of the induced CBT from level to . The text inside the circle , for denotes the th vertex from left at . The vertex , is also denoted by .

4. Embedding Trees of HB

In this section, we embed every tree into a generalized join of hypercubes. Before we proceed to the result, we define the join of graphs and prove certain preliminary lemmas.

Definition 3. The join (denoted by ) of two graphs and is defined as follows:

that is, joining each vertex of to every vertex of . Figure 3 shows the join of the hypercubes and .

(a)

(b)

(c)

Figure 3: The graph join .

Hence from the definition of graph join we have and . We denote the generalized join of graphs by . We note that .

Lemma 4. Let be a supertree of the complete binary tree of height with root formed by adding a new vertex and the edge . Let be the double rooted complete binary tree on vertices. Then .

Proof. Figure 4 shows the tree . We call as the deep root of . Consider an embedding as shown in Figure 4. Such an embedding has dilation since the edge is mapped onto a path of length in and this is the maximum shortest distance. The embedding has expansion since both and have vertices. Hence, in short, .

Figure 4: .

It is known that is a subgraph of ; see Nebeský [12]. Hence, this fact along with Lemma 4 implies the following.

Lemma 5. One has  .

In the next theorem, we give an embedding of every tree of into a generalized join of hypercubes.

Theorem 6. Let and let be the height of the complete binary tree rooted at the jth vertex from left at a level of . Then .

Proof. Consider . Let denote the th vertex from left in level . Decompose the tree into a forest of trees by deleting the set of edges for . Such a forest consists of complete binary trees rooted at (for ) and a complete binary tree induced by the vertices of from levels to . For , let where be the deep root of . Consider the embeddings (such embeddings exist by Lemma 5). For , consider (such an embedding exists by [12]). The vertices for and form a complete graph (a graph in which every pair of distinct vertices is connected by a unique edge) in and hence contain as subgraph the deleted set of edges of . Such an embedding technique is depicted in Figure 5. The dilation of the embedding is clearly and hence . The number of vertices of is and by (5), we have . Hence the expansion of the embedding is almost and is optimal.

Figure 5: Embedding of , in . The intermediate edges between every pair of vertices are not shown for clarity purpose.

5. Conclusion

In this paper, we have considered a subclass of height-balanced trees and have analysed the size of this subclass. We have also embedded every tree in this subclass into a generalized join of hypercubes.

Conflict of Interests

The author declares that there is no conflict of interests regarding the publication of this paper.

References

F. T. Leighton, Introduction to Parallel Algorithms and Architectures: Arrays, Trees, Hypercubes, Morgan Kaufmann, San Mateo, Calif, USA, 1992.

G. M. Adelson-Velskii and E. M. Landis, “An algorithm for the organization of information,” Soviet Mathematics Doklady, vol. 3, pp. 1259–1262, 1962.

P. Crescnzi and A. Piperno, “Optimal-area drawings of AVL trees,” in Proceedings of the DIMACS International Workshop on Graph Drawings, vol. 894 of Lecture Notes in Computer Science, pp. 307–317, 1994.

C. S. Ellis, “Concurrent search and insertion in AVL trees,” IEEE Transactions on Computers, vol. 29, no. 9, pp. 811–817, 1980.

M. Medidi and N. Deo, “Parallel dictionaries using AVL trees,” Journal of Parallel and Distributed Computing, vol. 49, no. 1, pp. 146–155, 1998.

C. C. Foster, “Information storage and retrieval using AVL trees,” in Proceedings of the ACM 20th National Conference, pp. 192–205, 1965.

P. L. Karlton, S. H. Fuller, R. E. Scroggs, and E. B. Kaehler, “Performance of height-balanced trees,” Communications of the ACM, vol. 19, no. 1, pp. 23–28, 1976.

S. N. Bhatt, F. R. K. Chung, F. T. Leighton, and A. L. Rosenberg, “Efficient embeddings of trees in hypercubes,” SIAM Journal on Computing, vol. 21, no. 1, pp. 161–162, 1992.

S. A. Choudum and S. Lavanya, “Embedding a subclass of trees into hypercubes,” Discrete Mathematics, vol. 311, no. 10-11, pp. 866–871, 2011.

I. Havel, “On Hamiltonian circuits and spanning trees of hypercubes,” Časopis pro Pěstování Matematiky, vol. 109, no. 2, pp. 135–152, 1984.

S. A. Choudum and I. Raman, “Embedding height balanced trees and Fibonacci trees in hypercubes,” Journal of Applied Mathematics and Computing, vol. 30, no. 1-2, pp. 39–52, 2009.

L. Nebeský, “On cubes and dichotomic trees,” Časopis pro Pěstováni Matematiky, vol. 99, pp. 164–167, 1974.