DEV Community

Discussion on: Algorithms for Ruby developer: Binary search

Collapse
 
kopylov_vlad profile image
Vladislav Kopylov

Thanks for your comment 😀
Yes, the binary search algorithm can work properly only with sorted data. Array#find_index can perfectly work with sorted and unsorted data. But if you have huge array of data and the array is sorted, binary search will be highly effective.

So, my intention was to inspire people (and me) to keep on studying algorithms, maybe it's the reason why I didn't mention it 🙈