Beispiel #1
0
        public void Merge(BinomialHeap <TKey, TValue> other)
        {
            List <BinomialTree <TKey, TValue> > oldRoots = rootList.Concat(other.rootList).OrderBy(tree => tree.Order).ToList();

            rootList = new List <BinomialTree <TKey, TValue> >();

            BinomialTree <TKey, TValue> currentTree = null;

            foreach (BinomialTree <TKey, TValue> tree in oldRoots)
            {
                if (currentTree == null)
                {
                    currentTree = tree;
                }
                else
                {
                    if (currentTree.Order < tree.Order)
                    {
                        rootList.Add(currentTree);
                        currentTree = tree;
                    }
                    else
                    {
                        currentTree = MergeTrees(currentTree, tree);
                    }
                }
            }

            if (currentTree != null)
            {
                rootList.Add(currentTree);
            }
        }
Beispiel #2
0
        public Crawler()
        {
            ipCache = new Dictionary <string, IPHostEntry>();

            frontier = new Queue <Uri>();

            backQueues       = new Queue <Uri> [256];
            domainBackQueues = new Dictionary <string, int>();
            backQueueHeap    = new BinomialHeap <DateTime, string>();

            //backQueueHeap = new SortedDictionary<DateTime, string>();

            crawledURIs = new HashSet <Uri>();

            foreach (Uri seed in Seeds)
            {
                EnqueueURI(seed);
            }
        }