更新时间:2023-02-13 23:39:09
如果,且仅当源数组排序,这可以在线性时间内完成的:
If, and only if, the source array is sorted, this can be done in linear time:
std::unique(a, a + 5); //Returns a pointer to the new logical end of a.
否则,你就必须先进行排序,这是(时为99.999%)ñLGñ。
ñLGñ
怎样才能在C或C ++中删除重复的地方数组中的元素在O(n)的?