in reply to better way to find list members?
You have mentioned that the array consists of numerical items only, if these are sorted beforehand then you can use a recursive function which checks the middle element of the list and decides if the target is above or below there and repeats the search on that section recursivly until the item might be found. I think I saw this on PM before but I dont feel like searching for the reference. This technique can be potentially faster for large, presorted arrays but otherwise another tecnique will be more efficient.
|