大家帮我看看这个作业,谢谢啦# Programming - 葵花宝典
D*s
1 楼
这个题答案难道不是N^2吗?
1.如果N=1000,how many array accesses will this require?
int find_product(int *a)
{
product = 1;
for (int i = 0; i < N; ++i) {
for (int j = i; j < N; ++j) {
product *= a[i] * a[j];
}
}
return product;
}
1.如果N=1000,how many array accesses will this require?
int find_product(int *a)
{
product = 1;
for (int i = 0; i < N; ++i) {
for (int j = i; j < N; ++j) {
product *= a[i] * a[j];
}
}
return product;
}