c# fastest way to get a subset of integer list -


i 5 list , need subset of all.

  • i) 200.000 integer values
  • ii) 30.000 integer values
  • iii) 10.000 integer values
  • iv) 200 integer values

in math terms n b n c n d. need 1.000 concurrent users.

  • what fastest way c# ?
  • how many concurrent operations can 1 2 mhz cpu ? 2 billion cycle speed

the fastest way of dealing finding intersection of multiple sets language-agnostic: create hashset<int>, initialize data shortest list, , sequentially call intersectwith on remaining lists. need start shortest list, because complexity of operation o(n+m), n number of items in hashset<int>, , m number of items in other list. since intersectwith called 4 times, , complexity of setting initial hashset<int> o(n), overall complexity be

o( n + n+m1 + n+m2 + n+m3 + n+m4) // ^    ^      ^      ^      ^ // |    |      |      |      | // |   intersecting lists 2..5 // | // setting initial hashset<int> 

since total o(5*n+m1+m2+m3+m4), best approach pick shortest list making initial set.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -