Example #1
0
 private CacheNode<int, double> BuildAndBalanceTree(int[] frequences, out float expectedFrequency, int maxFixedBranchDepth = 0)
 {
     var root = BuildTree(frequences, maxFixedBranchDepth);          
     var balancer = new CacheNode<int, double>.HeavyRebalancer(root, frequences.Length, 0, 1);         
     var watch = Stopwatch.StartNew();
     expectedFrequency = balancer.Rebalance();
     watch.Stop();
     Debug.Print("{0} balancing was", watch.Elapsed);
     root = balancer.ConstructNewTreeAfterCalculation();
     return root;
 }
Example #2
0
        private CacheNode <int, double> BuildAndBalanceTree(int[] frequences, out float expectedFrequency, int maxFixedBranchDepth = 0)
        {
            var root     = BuildTree(frequences, maxFixedBranchDepth);
            var balancer = new CacheNode <int, double> .HeavyRebalancer(root, frequences.Length, 0, 1);

            var watch = Stopwatch.StartNew();

            expectedFrequency = balancer.Rebalance();
            watch.Stop();
            Debug.Print("{0} balancing was", watch.Elapsed);
            root = balancer.ConstructNewTreeAfterCalculation();
            return(root);
        }