Description Usage Arguments Details Value Examples

Finds the index of the bin a number belongs to using binary search.

1 | ```
binarySearch_bin(arr, l, r, x)
``` |

`arr` |
A vector of size at least 2. |

`l` |
An integer between 1 and |

`r` |
An integer between 1 and |

`x` |
A number. Must be within the range of [ |

Finds the smallest index `i`

such that `arr[i] <= x <= arr[i+1]`

.

The index `i`

such that `arr[i] <= x <= arr[i+1]`

.

1 2 | ```
binarySearch_bin(1:10, 1, 10, seq(1, 10, by=0.5))
binarySearch_bin(1:10, 5, 8, seq(5, 8, by=0.5))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.