Algorithm to find if two sets intersect

后端 未结 7 1691
一向
一向 2021-01-01 23:22

Let\'s say I have two arrays:

int ArrayA[] = {5, 17, 150, 230, 285};

int ArrayB[] = {7, 11, 57, 110, 230, 250};

Both arrays a

7条回答
  •  借酒劲吻你
    2021-01-02 00:03

    If you don't care about memory consumption, you can achieve good performance by using hash, i.e. create hash with keys = values of one array, and test values of second array against this hash

提交回复
热议问题