0

what exactly is mean by paper to pencil algorithm and what is it? I am doing a program where two numbers are stored in an array, and are reversed in the array, and I need to add them together, how do I go about doing it with paper to pencil algorithm?

4
Contributors
3
Replies
6
Views
8 Years
Discussion Span
Last Post by siddhant3s
0

Someone else correct me if I'm wrong, but you just write in pseudo code (not completely syntactically correct) the basic algorithm.


Not quite sure what you're asking about the array though

1

I think what you are asking is how add number as long as 100 000 digits.

I think the algorithm you are talking about is basically you developing a piece of code that adds just the way you would add two numbers on a piece of paper. For example, you would start from the last digit of the number (the last digit on the right) and you add them. If the sum of these two digits is bigger than 9 then you carry 1 else you just store the sum of the two digits. You then move one digit left and you repeat the same process while taking the carried digit in account. The end result would be the sum of these two number!!

You also need to take a look at these topic :

> ASCII values of the numbers
> loops
> reversing arrays
> Padding make them equal in length
> Adding and substracting using ASCII values

I can't think of any more but there may be problems that you'll have to get around.....

Votes + Comments
Bingo!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.