Integer Division
Date: 02/05/07
(Algorithms) Keywords: java
I've been writing a class in Java similar to BigInteger.
I have been able to write arithmetic methods for add, subtract, and multiply using the same methods they teach grade school kids.
I am stuck on division (which honestly, I am lousy at doing myself with pencil and paper).
My integers can be huge, much larger than regular integer division within Java can handle. I am using a linked list to represent an integer. Each node in the list is a digit in the number.
I need a way to do division while only using one-to-a-few digits at a time. With my other methods I have used one digit from each number and a carry digit.
I am just baffled here because when I do long division I have to use the entire divisor, I can't break it up into pieces.
I'd love any help I can get. I need to have this finished soon though... like in about the next 4 hours.
Thanks!
Source: http://community.livejournal.com/algorithms/89439.html