Skip to content
Features
Replit AI
Collaboration
CDE
Deployments
Teams
Pricing
Guides
Blog
Careers
Log in
Start building
Features
Replit AI
Collaboration
CDE
Deployments
Teams
Pricing
Guides
Blog
Careers
Log in
Start building
Mr Mills
Core
@computinginschools
Owner of The Computing Café - a place to learn computer science, digital literacy and IT.
Public Apps
Jump links
11 months ago
dijkstra
2 years ago
howler.js demo
2 years ago
PHP Playground
2 years ago
Binary Tree
2 years ago
binary tree
2 years ago
haskell playground
2 years ago
Infix to Postfix
2 years ago
This program reads an infix expression from the user, converts it to postfix using the Shunting Yard algorithm, and then prints the postfix expression to the console. The InfixToPostfix method uses a stack to keep track of operators and operands as it scans through the infix expression. The IsOperand, IsOperator, and Precedence methods are helper functions that determine whether a character is an operand or operator, and what its precedence level is.
Evaluate Postfix Expression
2 years ago
The EvaluateRPN method takes in a string representing the expression in Reverse Polish Notation and returns the result as a double. The method splits the input string into tokens using the space character as a delimiter, and then iterates over each token. If the token is a number, it is pushed onto the stack. If the token is an operator (+, -, *, /), the method pops the top two elements off the stack, performs the corresponding operation, and pushes the result back onto the stack. If the token is not a valid number or operator, the method throws an exception. After all tokens have been processed, the method checks that there is exactly one element remaining on the stack, which is the final result of the expression. If there are more or less than one element on the stack, the method throws an exception.
copy text
2 years ago
View more