[Problem Suggestion] Reverse Polish Notation Calculator

Back to General discussions forum

FolieWasHere     2014-12-08 21:19:17

Make a Reverse Polish Notation. The input are some long expressions in RPN and the user has to give the correct result of every expression. The problem will teach users the concept of the stack. The idea is well documated so its not like its a magical unicorn people have to catch. K&R has a example where they make a RPN calculator in C, so there are examples of RPN in programming out there.

Rodion (admin)     2014-12-09 05:03:04
User avatar

Hi! Thanks for your suggestion!

It seems not too hard to implement so I'll try to create such exercise. The main my concern is that if there are ready RPN calculators online, people can easily use them... Though we'll see what can be done about this... :)

nicolas_patrois     2014-12-09 19:14:55
User avatar

Just add a special operation that’s not in the usual RPN calculators, for example an operator that reverses the entire stack (1-2-3-4-5 becomes 5-4-3-2-1) or that adds 42.

Rodion (admin)     2014-12-10 10:49:31
User avatar

Yes, this would work (though this will make exercise more like FORTH implementation).

The only puzzle is now how to create the test-case generator for this problem - but I'm already kicking around this and hope that soon the exercise will be ready!

Rodion (admin)     2014-12-10 16:55:42
User avatar

Just have published the problem!

I only regret your profile does not give hint on your name so I (at least temporarily) put your handle in the line referencing the author.

Please login and solve 5 problems to be able to post at forum