We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
这样的事情会做吗? 将所有 p{i} 放入数组中,函数将返回一个索引给获取该项目的人。 执行时间复杂度为 O(n)。
编辑:我还没有真正测试过这个。 我的观点是,您描述的函数并不是很复杂(如果我理解正确的话),并且您不需要下载库来解决这个问题。
Would something like this do? Put all p{i}'s in the array, function will return an index to the person who gets the item. Executes in O(n).
EDIT: I haven't really tested this. My point was that the function you described is not very complicated (if I understood what you meant correctly, that is), and you shouldn't need to download a library to solve this.
我刚刚测试了上面的方法 - 它并不完美,但我想对于我的目的来说,它应该足够了。 (groovy 中的代码,粘贴到单元测试中......)
i just tested out the method above - its not perfect, but i guess for my purposes, it ought to be enough. (code in groovy, pasted into a unit test...)
这是一个 Ruby 实现: https://github.com/cantino/walker_method
Here is a Ruby implementation: https://github.com/cantino/walker_method