コード例 #1
0
        public LeftistTree(T data, LeftistTree <T> child1, LeftistTree <T> child2)
        {
            _data = data;
            if (NullPathLength(child1) < NullPathLength(child2))
            {
                _rightChild = child1;
                _leftChild  = child2;
            }
            else
            {
                _rightChild = child2;
                _leftChild  = child1;
            }

            _nullPathLength = NullPathLength(_rightChild) + 1;
        }
コード例 #2
0
        public TValue RemoveYuksekOncelik()
        {
            if (_elementler == null)
            {
                throw new InvalidOperationException();
            }

            else
            {
                TValue tempValue = _elementler.Data.Value;
                _count--;
                _elementler = Merge(_elementler.LeftChild, _elementler.RightChild);

                return(tempValue);
            }
        }