Exemplo n.º 1
0
        public void MergeTest()
        {
            const string data1 = "What's in a name?";
            var          ts1   = data1.Split().Aggregate(SplayHeap <string> .Empty, (current, word) => SplayHeap <string> .Insert(word, current));

            const string data2 = "That which we call a rose by any other name would smell as sweet";
            var          ts2   = data2.Split().Aggregate(SplayHeap <string> .Empty, (current, word) => SplayHeap <string> .Insert(word, current));

            var t = SplayHeap <string> .Merge(ts1, ts2);

            Assert.AreEqual("[[[[a], a, [any, [as]]], by, [[call], in, [name]]], name?, [other, [[[[rose], smell], sweet, [That, [we]]], What's, [[which], would]]]]", DumpHeap(t));
        }