Skip to content

Instantly share code, notes, and snippets.

@Romain-P
Created January 18, 2018 19:39
Show Gist options
  • Select an option

  • Save Romain-P/f6875cf3c309b9b75c9901f8a885cf32 to your computer and use it in GitHub Desktop.

Select an option

Save Romain-P/f6875cf3c309b9b75c9901f8a885cf32 to your computer and use it in GitHub Desktop.
algo
else if (is_operator(c)) {
if (operators.empty() || operators.top() == LEFT) {
operators.push(c);
} else {
while (!operators.empty() &&
operators.top() != LEFT &&
OPS.at(c)._precedence <= OPS.at(operators.top())._precedence) {
operators.pop();
if (!operators.empty())
operands.push(operators.top());
}
operands.push(c);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment