How can you avoid O(N^2) cost if using unsorted array? So far there is no indication whether it would be sorted. (Addendum: I wasn't thinking so just quoted the O(N^2) cost, which really should have been O(N). Time to sleep belatedly, I suppose.)
I thought that List::MoreUtils::firstidx would use XS magic (to avoid copying). No? (I would have looked inside the C code myself but am not familiar with XS yet.)
Later ... I see now that array might be already sorted (and first element would be the interesting one).
In reply to Re^4: Testing if an array contains a value and then deleting it in most efficient way
by parv
in thread Testing if an array contains a value and then deleting it in most efficient way
by karpatov
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |