Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

To calculate an average in reverse polish notation (RPN) is the following correct (assuming a-j are variables representing numbers):

a,b,+,c,+,d,+,e,+,f,+,g,+,h,+,i,+,j,+,10,/

If it is correct, are there other ways that this could be expressed in RPN?

share|improve this question
2  
It's much easier to read if you use space instead of comma. –  TonyK Feb 6 '11 at 17:00

2 Answers 2

up vote 3 down vote accepted

This is correct. There are more ways to compute this but I would call your solution fairly canonical. For example, you could have started like this:

a,b,c,+,+,...

or like this:

10,1/x,a,b,+,...,*

However, these are fairly obvious variants and you are probably looking for a completely different way.

share|improve this answer

It does work as correct, and if Zev is correct here (I think he is) there exist 4862 different ways of writing this average in RPN or PN, since there exist 4862 different ways of parenthesizing the part which just involves the addition symbols in infix notation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.