Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
When converting the infix expression "(a+b)*(c-d)/e" to postfix, how many operator symbols appear in the postfix output?
- A. 5
- B. 3
- C. 6
- D. 4
Correct answer: D. 4
The operators are +, -, *, / (four in total), and the parentheses are removed by the shunting-yard algorithm. Counting the operand letters (five) is a different count.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is the sum of all odd positive divisors of 180?
- How many distinct sums arise from the length-3 windows of [1, 1, 2, 2, 3, 3, 1]?
- Among index pairs i < j of [-8, -3, -1, 2, 5, 9], how many pairs have the minimum possible absolute value of their sum?
- For [4, 1, 3, 7, 2], what is the maximum over index pairs i < j of min(a[i], a[j]) times (j - i)?
- How many non-empty substrings of "aabcab" are already in non-decreasing (sorted) order?
- What is the sum of the maxima of every window of size 2 in [9, 4, 7, 1, 8]?