CalcYouLater is a reverse Polish notation calculator that can handle basic arithmetic. Second project in the greatest course at Tufts University, Data Structures! There are also more complex operations, such as reading input from files and executing different operations based on a condition, allowing you to implement recursive computations like a factorial. There is also basic memory management like duplicating, removing and adding elements.
A stack was the main data structure I studied for this project—a very useful one for a reverse Polish notation calculator. You are able to easily add values to a list, and then pop them off when an operation is called. This is helpful because there is constant time access of the top of the element, unlike a linked list where accessing the end of the list, or the last pushed element, would require you to traverse to the full list to get to the end if there is not a back pointer. The LIFO ordering makes it easier to code too, because one only needs to worry about adding and removing from one end, so the logic does not get too complicated. Using a stack for an RPNCalc is especially helpful because there is not confusion from the client of what we can and cannot do in a stack, since there are less methods than in a list, so there is more data abstraction, making code easier to understand.
I’d love to share the code, but I cannot due to university course agreements. I really would like to show you if I had the change though! :^)
Leave a Reply