/Vector-Representation-to-generate-reverse-polish-notation

Method of converting a tree from analysis for the Polish notation reversed through the path after order of the tree and finally this reverse Polish notation will feed the P-code machine with instructions generated via code resulting in the numerical result of the expression contained in the tree.

Primary LanguageC

Vector Representation to generate reverse polish notation

About P code machine: https://en.wikipedia.org/wiki/P-code_machine

Input

The input of the binary tree in vector representation is done via file text and is considered to be formatted correctly. The positions that are not occupied in the tree / vector are represented by the character 'X' (maúsculo) to facilitate the process. The maximum size that this implementation supports is 30 characters. The reverse Polish notation is generated from a is text file and it is considered to be properly formatted. The input of the P code instructions is done inside the code itself from of the incoming Polish notation.

Output

To visualize the result in the execution of the source code, just execute it and make sure the input files are present. At the output of the p-code statements the null / zero state is not considered where the battery is completely empty. The reverse polynomial notation being analyzed in the p-code is printed at the beginning of the execution and its result will always be top of the final stack.