## 1 Introduction  
A traditional type class consists of all permutations of a fixed finite-length data string. There is a well-developed data compression theory in which strings in a traditional type class are losslessly encoded into fixed-length binary codewords [1]. One can generalize the notion of traditional type class and the resulting data compression theory in the following natural way. Let \(T\) be a finite rooted tree; an isomorphism of \(T\) is a one-to-one mapping of the set of vertices of \(T\) onto itself which preserves the parent-child relation. Let \(n\) be the number of leaves of \(T\), let \(\mathcal{L}(T)\) be the set of leaves of \(T\), and let \(\sigma\) be a one-to-one mapping of \(\{1,2,\cdots,n\}\) onto \(\mathcal{L}(T)\). Suppose \((X_{1},X_{2},\cdots,X_{n})\) is a data string of length \(n\). Define the \(T\)-type class of \((X_{1},\cdots,X_{n})\) to consist of all strings \((Y_{1},Y_{2},\cdots,Y_{n})\) for which there exists an isomorphism \(\phi\) of \(T\) such that  
\[Y_{i}=X_{\sigma^{-1}(\phi(\sigma(i)))},\ \ i=1,2,\cdots,n\]  
Consider the depth one tree \(T=T_{1}(n)\) in which there are \(n\) children of the root, which are the leaves of the tree. Then, the notion of \(T_{1}(n)\)-type class coincides with the notion of traditional type class. Now let \(n=k^{j}\) for positive integer \(j\) and integer \(k\geq 2\). Consider the depth \(j\) tree \(T=T_{j}(k)\) with \(n\) leaves such that each non-leaf vertex has \(k\) children. Then, a \(T_{j}(k)\)-type class is called a _hierarchical type class_, and \(k\) is called the _partitioning parameter_ of the class. In the paper [2], we dealt with hierarchical type classes in which the partitioning parameter is \(k=2\). In the present paper, we deal with hierarchical type classes in which the partitioning parameter is an arbitrary \(k\geq 2\). Given a hierarchical type class \(S\), there is a simple lossless coding algorithm which encodes each string in \(S\) into a fixed-length binary codeword of minimal length, and decodes the string from its codeword. This algorithm is particularly simple for the case when the partitioning parameter is \(k=2\), and we illustrate this case in Example 1 which follows; the case of general \(k\geq 2\) is discussed in [3]. In Example 1 and subsequently, \(x^{1}*x^{2}*\cdots*x^{k}\) shall denote the data string obtained by concatenating together the finite-length data strings \(x^{1},x^{2},\cdots,x^{k}\) (left to right). _Example 1_. Let \(k=2\), and let \(S\) be the hierarchical type class of data string \(AABBABAB\). The \(16\) strings in \(S\) are illustrated in Figure 1. Each string \(x\in S\) has a tree representation in which each vertex of tree \(T_{3}(2)\) is assigned a label which is a substring of \(x\). This assignment takes place as follows. * The leaves of the tree, traversed left to right, are labeled with the respective left-to-right entries of the data string \(x\). * For each non-leaf vertex \(v\), if the strings labeling the left and right children of \(v\) are \(x_{L}\), \(x_{R}\), respectively, then the string labeling \(v\) is \(x_{L}*x_{R}\) if \(x_{L}\) precedes or is equal to \(x_{R}\) in the lexicographical order, and is \(x_{R}*x_{L}\), otherwise. In Figure 1, we have illustrated the tree representations of the strings \(AABBABAB\) and \(BAABBBAA\). The root label of all \(16\) tree representations will be the same string, namely, the first string in \(S\) in lexicographical order, which is the string \(AABBABAB\) in this case. Each string in \(S\) is encoded by visiting, in depth-first order, the non-leaf vertices of its tree representation whose children have different labels. Each such vertex is assigned bit \(0\) if its label is \(x_{L}*x_{R}\), where \(x_{L}\), \(x_{R}\) are the labels of its left and right children, and is assigned bit \(1\) otherwise (meaning that the label is \(x_{R}*x_{L}\)). The resulting sequence of bits, in the order they are obtained, is the codeword of the string.