【发布时间】:2016-08-31 13:18:22
【问题描述】:
这是给你 CompSci 或统计人员的。你能告诉我,如果 theList 包含 72,786 个“事物”,那么在循环结束时 compareCount 的值是多少?我想它是 72,786^2-1,但这个老大脑已经很久没有这样工作了。非常感谢您的时间和帮助!
List<thing> theList = new List<thing>();//list contains 73,786 "things"
private void compare()
{
int compareCount = 0;
for(int i = 0; i < theList.Count-1; i++)
{
for(int comp = i + 1; comp < theList.Count; comp++)
{
compare(theList[i], theList[comp]);
compareCount++;
}
}
}
【问题讨论】:
-
你为什么不运行它来找出答案?
-
我是 - 我正在尝试根据目前发生的情况确定何时完成以及我可能会遇到哪些内存问题。如果 list.Count^2-1 是正确的,我大约完成了 2%。如果这是正确的数字,那么在 99% 的 CPU 负载下,我的 ETC 略少于 30 天。
-
如果这只是一道数学题,那么它不属于 Stack Overflow。你应该把它发到math stack exchange。
-
打算作为一个可能的双部分,但在我知道第一部分之前询问第二部分是没有意义的。
标签: c# statistics computer-science