Skip to content

nibilis/Arithmetic-expression-binary-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Arithmetic expression binary tree

This repository contains the Java code for a program that constructs a binary expression tree from a user-input arithmetic expression. The program validates the expression, displays the resulting tree in different traversal orders, and computes the expression's result using the binary tree.

Features

The program offers the following options in a menu:

  1. Input arithmetic expression (infix notation): The user enters an expression in infix notation. The expression is validated, and a message is displayed indicating whether it is valid or invalid.
  2. Create binary expression tree: The entered infix expression is converted into a binary expression tree.
  3. Display binary expression tree: The tree is displayed in three different traversals:
    • Pre-order
    • In-order
    • Post-order
  4. Calculate expression: The tree is traversed to compute the expression. The result is displayed on the screen.
  5. Exit the program: Ends the program execution.

Expression Requirements

  • The expression must contain only integers and/or decimal numbers, parentheses, and the following binary operators: +, -, *, /.
  • Valid expressions will be processed, while invalid expressions will result in an error message.

Developers

About

Arithmetic expression solver using a binary tree

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages