{"id":22960375,"url":"https://github.com/janniklth/arithmetictree","last_synced_at":"2026-07-03T09:06:11.889Z","repository":{"id":176580178,"uuid":"658920262","full_name":"janniklth/ArithmeticTree","owner":"janniklth","description":"The project aims to develop a system that can parse arithmetic expressions as binary trees in all three representations, build the arithmetic tree from the input, and evaluate the result of the tree, along with determining the number of nodes and the depth of the tree.","archived":false,"fork":false,"pushed_at":"2023-07-20T21:44:43.000Z","size":474,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-07T17:45:05.450Z","etag":null,"topics":["binarytrees","dhbw","dhbw-stuttgart","expressiontree"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/janniklth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-26T19:12:42.000Z","updated_at":"2023-07-18T09:33:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"17c4be08-5050-4fb6-9162-64f72d5d9e30","html_url":"https://github.com/janniklth/ArithmeticTree","commit_stats":null,"previous_names":["janniklth/arithmetictree"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janniklth%2FArithmeticTree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janniklth%2FArithmeticTree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janniklth%2FArithmeticTree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janniklth%2FArithmeticTree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janniklth","download_url":"https://codeload.github.com/janniklth/ArithmeticTree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246746880,"owners_count":20827061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binarytrees","dhbw","dhbw-stuttgart","expressiontree"],"created_at":"2024-12-14T18:33:10.630Z","updated_at":"2026-07-03T09:06:06.847Z","avatar_url":"https://github.com/janniklth.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ArithmeticTree\nThis repository contains a project developed as part of the IT-Automotive study at DHBW Stuttgart. It is a submission for the Algorithms and Complexity course.\n\n\n## Disclaimer and Attribution\nWe would like to mention that we have developed this project entirely on our own. Any code or resources that were not developed by us have been appropriately marked as such and attributed to their original sources.\n\n\n## Description\n\nThe ArithmeticTrees project focuses on parsing arithmetic expressions as binary trees in three different representations: prefix, infix, and postfix. The main objective is to build the arithmetic tree based on the input expression and evaluate its result, along with determining the number of nodes and the depth of the tree.\n\n\n### Class Diagram\n\nThe project follows the following class diagram:\n\n\u003cimg src=\"doc/UML_ArithmeticTree.png\" alt=\"Alt text\" title=\"Optional title\"\u003e\n\n\n- `Token`: pure virtual class representing a token, which is either an operator, a bracket, or a number\n   - `Operator`: represents an operator token, which is either `+`, `-`, `*`, or `/`\n   - `Bracket`: represents a bracket token, which is either `(` or `)` \n   - `Number`: represents a number token, which is a positive integer\n- `Evaluator`: evaluates the result of an arithmetic tree, by traversing the tree and calculating the result\n- `Tokenizer`: parses an arithmetic expression into a vector of Token objects\n- `Visualizer`: visualizes an arithmetic tree in the terminal, by printing the tree in a tree-like structure\n\n\n### Features\n\n- Parsing arithmetic expressions in prefix, infix, and postfix notation.\n- Building binary trees from the parsed expressions.\n- Evaluating the result of the arithmetic tree.\n- Determining the number of nodes in the tree.\n- Calculating the depth of the tree.\n  \n\n## Getting Started\n\n### Prerequisites\n\n- C++ compiler\n\n### Installation\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/janniklth/ArithmeticTree.git\n\n2. Compile the source code using a C++ compiler:\n\n   ```bash\n   g++ main.cpp -o ArithmeticTreeEvaluator\n\n### Usage\n\n1. Navigate to the project directory.\n\n2. Run the compiled executable and enter an arithmetic expression and the given notation:\n\n   ```bash\n   ./ArithmeticTreeEvaluator -e \u003c\"expression\"\u003e -m \u003cnotation\u003e\n    ```\n   - -m \u003cnotation\u003e: Specifies the notation of the arithmetic expression. The \u003cnotation\u003e can be one of the following:\n     - `infix`: Indicates that the expression is in infix notation. \n     - `postfix`: Indicates that the expression is in postfix notation. \n     - `prefix`: Indicates that the expression is in prefix notation. \n   - -e \u003c\"expression\"\u003e: Specifies the arithmetic expression to be evaluated. The \u003c\"expression\"\u003e should be enclosed in quotes to ensure correct parsing.\n\n   Infix-Example: \n\n    ```bash\n    ./executable -e \"(((2 + 112) + 24) * ((100 / 5) * 3))\"  -m infix\n    ```\n\n\n\n4. The program will parse the expression, build the arithmetic tree, and evaluate and visualize the result.\n\n\n## Example\n\n```c++\n// Example code placeholder\n```\n\n## Development\nWe have utilized Git for version control, and as a result, specific version references are omitted in the class and method comments. The project has been developed collaboratively using pair programming techniques, which is why individual author attributions have been omitted.\n\n\n## Contributing\n\nContributions to the ArithmeticTree project are welcome. If you find any issues or would like to suggest improvements, please open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License. For more information, please see the [LICENSE](LICENSE) file.\n\n## Contact\n\nThank you for checking out our project. We hope it is fun to experiment and helpful in expanding your knowledge of C++ and binary trees. If you have any questions, don't hesitate to contact ous.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanniklth%2Farithmetictree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanniklth%2Farithmetictree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanniklth%2Farithmetictree/lists"}