[removed] efficiently compare two integer arrays

后端 未结 6 1296
庸人自扰
庸人自扰 2020-12-30 03:14

I have two integer arrays which contain numeric values. I want to look through both lists and check for commonality (or lack of) between the lists. I.e. I want to iterate th

6条回答
  •  甜味超标
    2020-12-30 03:58

    Another possibility could be order those arrays while you create them. I am not sure if you can do that. But if you can, it will increase a bit the complextity of adding an element to the array (O(log n) instead of O(1)) but it will decrease the complexity of your comparison algorithm to O(n)

提交回复
热议问题