For an ordered list, the complexity of the binary search time is O (logN). However, in Elixir, a list is linked by a list, so to get the middle element of the list, you need to repeat N / 2 times, which makes the general O (NLogN) search.
So my question is:
- Is the time complexity correctly exceeded?
- If this is correct, binary search does not make sense in Elixir, right? You have to iterate over the list to get what you want, so O (N) is best.
source
share