计算 monte carlo 算法的时间和 space 复杂度

Finding the time and space complexity of a monte carlo algorithm

我还是 Whosebug 的新手所以如果我做错了请原谅我^^'

我需要帮助来找到近似 pi 值的 Monte Carlo 算法的时间和 space 复杂度。我很难在 Google 上寻找答案,所以我希望在这里找到答案 ^^。

根据this article,这取决于INTERVAL。但是你可以根据你想要的精度来改变它。基本上,它 Defines precision for x and y values. More the interval, more the number of significant digits

编辑

根据文章,时间复杂度为 O(N^2) 其中 N 为 INTERVAL