hey there i find it difficult to write pseudocode of two stacks that sum two binary numbers and print the answer i can use a third stack for help. for example S1 is 11001110 and S2 101010 the answer will print 11111000 please help me with that

3 Years
Discussion Span
Last Post by Taywin

What have you tried so far?

Do you have more specific instructions? What is supposed to go into the stacks? I would guess digits.

You'll need to track some extra data, but you shouldn't need a whole third stack.


cant you just convert it to a decimal number (e.g. int), add them up, and then convert back to binary?

This looks like an assignment intended to illustrate a few concepts about stacks and arithmetic algorithms; such a conversion would defeat its purpose. But if it's not (Sami will have to tell us), there are indeed simpler ways to add numbers.

Edited by gusano79


If the answer is to print, you do not need another stack but rather a variable to hold the carrier...

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.