/**
         * build the tree
         */
        private void InitSelection()
        {
            while (PqNodeSelector.Count > 1)
            {
                // get the minimum 2 node
                HuffmanNode rightNode = PqNodeSelector.Dequeue();
                HuffmanNode leftNode  = PqNodeSelector.Dequeue();

                HuffmanNode parentNode = new HuffmanNode(-1,
                                                         rightNode.Frequincy + leftNode.Frequincy,
                                                         leftNode, rightNode);

                PqNodeSelector.Enqueue(parentNode);
                NodesCounter++;
            }

            // the final node is the root node
            RootNode = (HuffmanNode)PqNodeSelector.Dequeue();
        }
 public HuffmanNode(HuffmanNode thatNode) : this(thatNode.NodeValue, thatNode.Frequincy, thatNode.RightNode,
                                                 thatNode.LeftNode)
 {
 }
 private bool Equals(HuffmanNode other)
 {
     return(NodeValue == other.NodeValue && Frequincy == other.Frequincy && Equals(RightNode, other.RightNode) &&
            Equals(LeftNode, other.LeftNode));
 }