Algs4-1.5.21Erdos-renyi模型
1.5.21Erdos-renyi模型。使用练习1.5.17的用例验证这个猜想:得到单个连通分量所需生成的整数对数量为~1/2NlnN。
![图片](http://r.photo.store.qq.com/psb?/f33bb27a-608a-4097-811a-86bbde18cf7a/01tigzc9B*vyjrsxV.CqMfipZJJDK7wSfRNI.sINpWM!/o/dLIAAAAAAAAA&ek=1&kp=1&pt=0&bo=tQFJA7UBSQMDEDU!&tl=1&su=0211466497&tm=1540519200&sce=0-12-12&rf=2-9)
public class E1d5d21
{
public static void main(String[] args)
{
int T=Integer.parseInt(args[0]);
for (int t=1;t<=T;t++)
{
StdOut.println("times=" + t);
for (int i=2;i<Math.pow(2,16);i=2*i)
StdOut.printf("N=%9d count=%9d 1/2NlnN=%9.0f\n",i, ErdosRenyi.count(i),0.5*i*Math.log(i));
}
}
}
public class E1d5d21
{
public static void main(String[] args)
{
int T=Integer.parseInt(args[0]);
for (int t=1;t<=T;t++)
{
StdOut.println("times=" + t);
for (int i=2;i<Math.pow(2,16);i=2*i)
StdOut.printf("N=%9d count=%9d 1/2NlnN=%9.0f\n",i, ErdosRenyi.count(i),0.5*i*Math.log(i));
}
}
}