private void Increment(Node *node) { Node *lnode; if (node == null) { return; } if (node->next != null && node->next->weight == node->weight) { lnode = *node->head; if (lnode != node->parent) { this.Swap(lnode, node); } Huffman.Swaplist(lnode, node); } if (node->prev != null && node->prev->weight == node->weight) { *node->head = node->prev; } else { *node->head = null; this.FreePPNode(node->head); } node->weight++; if (node->next != null && node->next->weight == node->weight) { node->head = node->next->head; } else { node->head = this.GetPPNode(); *node->head = node; } if (node->parent != null) { this.Increment(node->parent); if (node->prev == node->parent) { Huffman.Swaplist(node, node->parent); if (*node->head == node) { *node->head = node->parent; } } } }