>Integer Division with Modulus in Ruby, using Linear and Binary Search
reinventone.substack.com
> I was recently chatting with someone about algorithms, and we were talking about efficient algorithm for implementing integer division with modulus, and how to make it efficient for large integers. The following code snippet shows a class that implements two division methods, linear and binary. I wonder if there is a more elegant way to implement binary, please feel free to post to comments if there are. Also, any other faster methods are welcome.
>Integer Division with Modulus in Ruby, using Linear and Binary Search
>Integer Division with Modulus in Ruby…
>Integer Division with Modulus in Ruby, using Linear and Binary Search
> I was recently chatting with someone about algorithms, and we were talking about efficient algorithm for implementing integer division with modulus, and how to make it efficient for large integers. The following code snippet shows a class that implements two division methods, linear and binary. I wonder if there is a more elegant way to implement binary, please feel free to post to comments if there are. Also, any other faster methods are welcome.