Using your own Linked List implementation (see attached), implement a class called HugeInteger that represents arbitrary sized integers and supports addition only. You may only use the tools that have introduced in class, and you MAY NOT use Java's BigInteger class.
Think about the limitation that we have with the integer in the long primitive types so these are all integer typesa integer can hold only numbers between from negetive to billion and positive to billion, long can hold bigger numbers but still not infinite numbers using a linked list i want you to represent an infinite size number it will give slower as your numbers get big so understand if you try to represent a number with ten trillion places in it so its going to get slow, the point is we are using link list to represent numbers that are arbitrary in size could be as long could be as huge integers we want, Your huge integer class should support adding huge integer together. Example( if you have one huge integer and another huge integer you should be able to add those two together producing another huge integer which is the sum of those two).So both huge integers are represented as linked lists. so you have to go back and do addition per node with the carry bits. One thing you have to our code which is the ability to get a node at a particular index. Right now we have to remove but we might not want to remove it we might want to have get it. So getting a node at a specific index is going to be very similar to remove expect we wont disconnect stuff.
We are only required to make HugetInteger for addition.
NOTE: I have attached a zip file it is for the idea of how to do it as I did in my school so you have to do according to the zip file.
- 6 years ago
Purchase the answer to view it