App that performs add. and sub. of arbitrarily large pos int's
Joined: Feb 23, 2006
I have to implement a application that performs addition and subtraction of arbitrarily large positive integers. In doing so I am not allowed to use any math packages, only ADT's. I beleive a doubly linked list would be easiest and most efficient but am having trouble coding the idea. Thanks.
Joined: Jan 17, 2006
How are you thinking of using a LinkedList to implement this? What is your current strategy?
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
IMHO, I think it would be much easier to determine what Data Structure is best, if we had some idea of what the algorithm, that the original poster was thinking of using. You might get a better answer, and maybe some help, if you give us idea of how you are going to accomplish the task.
Using an array how would the add method be implemented?
Joined: Mar 22, 2005
Without trying to sound snippy: That's for you to figure out. This sounds like a homework assigment, and we don't do peoples homework for them. If, on the other hand, you have an idea of what to do but have trouble implementing it, then come back here, and we'll be happy to help you get going again.
Originally posted by R Wall: Using an array how would the add method be implemented?
I don't think I'm giving too much away if I suggest you use some square boxes drawn on a piece of paper to simulate the arrays. Write the numbers in the square boxes, one digit per box. Put one number above the other. Then, try to recall the way you add two numbers (the way you learned when you were about 8 years old but now do without thinking). Convert that into Java code.