void buildTree(minheap obj)
        {
            while (getSize(obj) >= 1)
            {
                if (top == null)
                {
                    huffman left  = obj.extractMin();
                    huffman right = obj.extractMin();
                    top = new huffman(left.data + right.data, '-');

                    top.left  = left;
                    top.right = right;

                    obj.insert(left.data + right.data, '-');
                }
                else
                {
                    huffman left  = obj.extractMin();
                    huffman right = top;

                    huffman obj_huff = new huffman(left.data + right.data, '-');
                    obj_huff.left  = left;
                    obj_huff.right = right;

                    top = obj_huff;


                    obj.insert(left.data + right.data, '-');
                }
            }
        }
        void start(string str)
        {
            Dictionary <char, int> dict = freq(str);

            huffman[] arr = getArrayFromDict(dict);
            minheap   obj = new minheap(arr, arr.Length);

            buildTree(obj);
            printtree(top, "");
        }
        int getSize(minheap obj)
        {
            int size = 0;

            for (int i = 0; i < obj.size; i++)
            {
                if (obj.arr[i].c == '-')
                {
                    ;
                }
                //size--;
                else
                {
                    size++;
                }
            }

            return(size);
        }