by Ricardo Fernández Serrata
Faster than indexOf() if the array is huge. Supports: text string if the target is an integer, dictionary where keys are decimal integers and array of text strings.
The example array contains the 1st 32 prime numbers. The example target value to search is set to 11, which should return 4 if the array is kept sorted in ascending order.
It WON'T work correctly if the container is unsorted or sorted in descending order.
I added protection against infinite looping by checking if #A equals 0.
If T = null and #A = 0, the output will be null. In any other case, the output is guaranteed to be an integer.
For even faster performance, this uses branchless computing techniques.
Rate and review within the app in the Community section.