It depends on n and k but obviously as n gets big, that one is going to be better.
但是很明显,当n取很大的值的时候,前者要比后者好。
Now I'm in better shape, right? Especially for really large n or for a lot of k, because now in general, this is going to be smaller than that.
很大的k也大的情况,因为这样这就比这个小了,这种情况是分摊。
k * n m plus k all times log n is in general going to be much better than k times n.
在普遍情况下要远远好于,实际情况要取决于n和k的取值。
In the linear case, meaning in the unsorted case what's the complexity of this? k times n, right? Order n to do the search, and I've got to do it k times, so this would be k times n.
复杂度是多少?k的n次方,对吧?,在序列n中做搜索,要做k次,所以是k的n次方次,如果先排序后搜索。
应用推荐