The fastest way to find union of sets

后端 未结 7 453
说谎
说谎 2021-01-11 09:39

I have sets of pairs of int like set > x1, x2, ... xn ( n can be between 2 and 20). What is the fastest way to find union of those se

相关标签:
7条回答
  • 2021-01-11 10:34

    You could use std::set_union recursively or simply insert all sets into a result set (duplicate items are eliminated by the set). If the number of items is very small you can try to insert it all into a vector, sorting it and use std::unique on the vector.

    0 讨论(0)
提交回复
热议问题