[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: In a sorted integer list FindSorted Fails if there is more than one instance of value!


Le 11/09/2025 à 22:04, Brian G a écrit :
I am not sure I understand how array.findSorted should work, but it appears to never find the first instance of a value in a sorted list when there is more than one instance of the value, seems to be random.

It's not random, it's the documentation that is inaccurate.

FindSorted() is just a binary search, and so never find the *first* element in array order, but the first it encounters while following the binary search order.

Returning the first occurence in array order would be a performance penalty, and I don't understand how it would be useful. Please elaborate!

Regards,

--
Benoît Minisini.