lib/hash_ring.rb
#
# Bisects an array, returning the index where the key would
# need to be inserted to maintain sorted order of the array.
#
# That being said, it is assumed that the array is already
# in sorted order before calling this method.
Bisects an array, returning the index where the key would
need to be inserted to maintain sorted order of the array.

That being said, it is assumed that the array is already
in sorted order before calling this method.
Bisects an array returning the index where the key would need to be inserted to maintain sorted order of the array . That being said it is assumed that the array is already in sorted order before calling this method .
def bisect(arr, key)
    arr.each_index do |i|
      return i if key < arr[i]
    end
    return arr.length
  end
def bisect ( arr , key ) arr . each_index do | i | return i if key < arr [ i ] end return arr . length end
Bisects an array, returning the index where the key would
need to be inserted to maintain sorted order of the array.
Bisects an array returning the index where the key would need to be inserted to maintain sorted order of the array .
arr
key