Infix vs Postfix

There was this question in an interview yesterday. Which is better to use? Infix (with parentheses) or Postfix? State of mind.

I can only tell them that:

  • it is easier for compilers to process a postfix expression for arithmetic estimates and operator priorities.
  • For storage and processing of brackets, additional memory is used.

Please throw some light on whether I am right on this?

+3
source share
3 answers

Postfix does not require any operator-driven operations; he is always explicit. Therefore, for the stack-based compiler, it is very easy to implement, and for people it is easy to understand the order of operations.

, infix , : -P. ; " A B" , "A B: ".

. Postfix , infix .

+6

. . Postfix , ( ).

Postfix , Java, Forth, Postscript. .

Infix .

, , , , .

+1

Infix, Postfix :

  • ( , , )

Infix, Postfix :

  • Infix . .
  • Infix . , , , , postfix . ( @EJP
  • . , , postfix , , , , , , .

-1
source

Source: https://habr.com/ru/post/1759631/


All Articles