1.5.21

1.5.21 #

解答 #

给出我电脑上的结果:

实验结果:16
1/2NlnN:11.51292546497023

实验结果:38
1/2NlnN:29.957322735539908

实验结果:89
1/2NlnN:73.77758908227872

实验结果:194
1/2NlnN:175.28106538695525

实验结果:455
1/2NlnN:406.0139052187061

实验结果:1050
1/2NlnN:922.9313593270035

实验结果:2300
1/2NlnN:2067.6698164331897

实验结果:4918
1/2NlnN:4578.953828424745

实验结果:10812
1/2NlnN:10045.136047966218

实验结果:23478
1/2NlnN:21864.728878165897

代码 #

for (var n = 10; n < 10000; n *= 2)
{
    var total = 0;
    for (var i = 0; i < 100; i++)
    {
        var uf = new Uf(n);
        total += ErdosRenyi.Count(uf);
    }

    Console.WriteLine("实验结果:" + total / 100);
    Console.WriteLine("1/2NlnN:" + Math.Log(n) * n * 0.5);
    Console.WriteLine();
}

另请参阅 #

UnionFind 库