-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Currently, the bsearchIndex method is using slice, which creates a partial, shallow copy of the original array into a new array -- meaning it uses extra memory. This extra memory is unnecessary and will scale when handling large arrays. We can avoid this with simple manipulation of the starting and ending indexes ("i" and "j", respectively).
Moreover, instead of using recursion, this can be done with a loop which is actually more efficient.
Lastly, it will be helpful if this phrase is added in the docs:
Use bsearchIndex or bsearch on arrays, assuming it is already sorted.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels