线性时间的算法来计算笛卡尔积笛卡尔、线性、算法、时间

由网友(戒烟戒酒戒女人°)分享简介:有人问我,在接受采访时拿出与笛卡尔积线性时间的解决方案。我做了迭代的方式O(MN)和递归解决方案也这也是O(MN)。但我无法进一步降低复杂性。有没有人对这种复杂性,如何进行改进?同时任何人都可以提出一个有效的递归的方法呢?I was asked in an interview to come up with a so...

有人问我,在接受采访时拿出与笛卡尔积线性时间的解决方案。我做了迭代的方式O(MN)和递归解决方案也这也是O(MN)。但我无法进一步降低复杂性。有没有人对这种复杂性,如何进行改进?同时任何人都可以提出一个有效的递归的方法呢?

I was asked in an interview to come up with a solution with linear time for cartesian product. I did the iterative manner O(mn) and a recursive solution also which is also O(mn). But I could not reduce the complexity further. Does anyone have ideas on how this complexity can be improved? Also can anyone suggest an efficient recursive approach?

推荐答案

明尼苏达州的结果;你所要做的最小的工作是编写的每个结果输出。所以你不能做的比好O(MN)

There are mn results; the minimum work you have to do is write each result to the output. So you cannot do better than O(mn).

阅读全文

相关推荐

最新文章