示例#1
0
        public void Merge(SkewHeap <T> other)
        {
            if (this == other)
            {
                return;
            }
            Node otherRoot = null;

            if (other != null)
            {
                otherRoot = other.root;
            }
            root = MergeHeap(root, otherRoot);
        }
示例#2
0
        static void SkewHeapTest()
        {
            int[]          values  = { 3, 10, 8, 21, 14, 23, 17, 26 };
            int[]          values2 = { 37, 33, 24, 18, 18, 12, 7, 6 };
            SkewHeap <int> heap1   = new SkewHeap <int>();
            SkewHeap <int> heap2   = new SkewHeap <int>();

            foreach (var v in values)
            {
                heap1.Add(v);
            }
            foreach (var v in values2)
            {
                heap2.Add(v);
            }
            heap1.Merge(heap2);
        }