cpu and disk used to build an ngram memory structure is proportional to the total cardinality of the memory structure minimizing the cardinality of each node would also minimize the computing resources used when the local minimum is not unique two pairs yielding the same cardinality the algorithm arbitrarily picks out the first pair that has that cardinality this may lead to some sub optimal structures because the cardinality at lower levels of the memory structures will affect the cardinality at higher levels and consequently the entire memory structure itself note however that finding the optimum structure in this case would in the limit be equivalent to an exhaustive search and very expensive if not impossible to obtain the major concern for optimality in the case of database compression is to find an optimal ngram memory structure from among many possible combinations of patterns or memory structure topologies for n parallel streams fields or columns in a table there are n 1 nodes in an n gram memory structure and at a given level in an n gram memory structure there are only n 1 pattern combinations for the n nodes the total number of pattern combinations is the multiple of the number of pattern combinations in all levels of the n gram memory structure for example a symmetric n gram memory structure consisting of 8 fields contains 7 5 3 105 total patterns a symmetric memory structure of 16 fields contains 15 13 11 9 7 5 3 2 027 025 patterns if one wants to find a particular pattern.