Today I have to search items of list from another list individually. I am just thinking about some better approach. Below is scenario described.Lets say I have two arrays, arr1 having 100 elements (may have duplicate entries) and arr2 having 1000 unique elements. now i need to find elements of arr1 from arr2 and perform some action on it. Should i loop through arr1 items and then search them in arr2 and perform desired action. or iterate on arr2 and search its items from arr1 and if found, perform desired action on arr2 item. which will be efficient way? Obvious choice seems to be first way, but i wanted to compare its perofrmance (dis)advantages over the other. In my opinion both will be almost same.
Search list items from other list, better way?
algorithms;search;list