Fastest way to search for an element in unsorted array

后端 未结 10 1789
北恋
北恋 2020-12-14 08:13

I just bumped on to this question today and was trying for a solution that is better than O(N) but could not come up with one.

Searched through SO but couldn\'t find

10条回答
  •  不思量自难忘°
    2020-12-14 09:13

    Make it parallel. Divide the array in chunks and search in parallel. The complexity will be O(n) but running time will be much less. Actually it will be proportional to no. of processors you have.

    You can use Parallel Patterns Library in C++

提交回复
热议问题