Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexandervasyuk/e66117d0ba1ff9408bc7 to your computer and use it in GitHub Desktop.
Save alexandervasyuk/e66117d0ba1ff9408bc7 to your computer and use it in GitHub Desktop.
parenthesis functionality infix binary tree
if (token == '(') {
operatorStack.push(token);
} else if (token == ')') {
while(operatorStack.peek() != '(') {
var subtree = createSubtree(operatorStack.pop(), null);
outputStack.push(subtree);
}
operatorStack.pop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment