 Hello everyone, I am Mrs. Meenakshi Shrigandhi from Vulture Institute of Technology, Sholapur. Welcome to the video lecture on Stack Application in Fixed to Post-Fix Conversion. Learning outcome, at the end of this session, student will be able to illustrate stack application for in fix to post-fix conversion. Application of stack? As we already know that stack is a leave for structure, that is the last item to be inserted is the first to be removed. Its application can be seen in execution of sub-programs in a computer system, where a sub-program before its execution of the task, push its written address on the stack and after the execution of a task, it comes back to the stack and pops a written address and goes to the main function. The application of stack can also be seen in recursion. Recursion is nothing but when a function calls itself. Before a function executed task, it saves its written address on the stack and after the execution of the task, it pops a written address. The application of stack is also seen in expression evaluation of post-fix string and application of stack can also be seen in expression conversion from in fix notation to post-fix notation. Let us see what is in fix, post-fix and prefix ease. It refers to the relative position of the operator with respect to the two operands. If the operator is in between the two operands, it is called as infix. If the operator is placed after the two operands, it is called as the post-fix. If the operator is placed before the two operands, it is called as the prefix. Conversion of infix expression to post-fix expression. While we are converting the infix expression to the post-fix expression, the order of the precedence is same as the original infix expression. And while we are doing this, the operators are stacked in the stack and they are unstacked at the proper time and pass to the output post-fix string. Let us see the algorithm for conversion of infix expression to post-fix expression. First we need to clear the stack and we need to take the input character into the symbol. While we don't reach to the end of the string, if the symbol is an operand, then we need to add this symbol to the post-fix string. Else, if the symbol is in closing bracket, while the top of the stack is not equal to the opening bracket, we need to pop all the stack elements and add the popped elements to the post-fix string. And after that, we need to pop the stack to remove the opening bracket also. If it is not an opening bracket, else, then while the stack is not empty and the precedence of the top of the stack is higher than the symbol, then we need to first pop the stack and add the popped element to the post-fix string. Then we need to push the new symbol to the stack. After this, again we need to take the next input character and this process is continued till we reach the end of the string. Once we reach the end of the string, while the stack is not empty, we need to pop all the stack elements and we need to add the popped elements to the post-fix string. Based on the algorithm, try to think and answer to convert the infix expression a plus b into c to post-fix form. Here we are trying to convert the infix expression a plus b into c to post-fix form. For this, we need a table consisting of three columns containing symbol, stack and output. The first symbol is a. As it is an operand, it is sent to the output. At this stage, the stack is empty. The next symbol is plus. As it is an operator, we need to push it on the stack. The output remains the same, that is a. The next symbol is b. As it is an operand, it is sent to the output. So the output consists of a, b. The stack remains the same, that is plus. The next symbol is multiplication operator. As it is an operator, we need to push it on the stack. But while pushing it on the stack, we need to check the precedence of the top of the stack. At present stage, the top of the stack is plus. And the precedence of multiplication operator is higher than plus. So we can push it on the stack. So the stack consists of two elements, that is plus and multiplication operator. Multiplication operator being the top of the stack. The output remains the same, that is a, b. The next symbol is c. As it is an operand, we need to send it to the output. So the output consists of a, b, c. The stack remains the same, that is plus and multiplication operator. We have reached to the end of the input. At this stage, we need to pop all the stack elements and place it to the output. So the output consists of a, b, c, multiplication operator plus. So at this stage, the stack is empty. So the final postfix expression is a, b, c, multiplication operator plus. Think an answer to convert the infix expression, bracket a plus b, bracket close, multiplication operator c to postfix form. Here we are trying to convert the infix expression, bracket a plus b, bracket close into c to postfix form. The first symbol in this is a bracket which is an operator. So we need to push it on the stack. The output at this stage is empty. The next symbol is a. As it is an operand, it is sent to the output. The stack remains the same. The next symbol is plus. As it is an operator, it is pushed on the stack. So the stack consists of opening bracket and plus operator. The output remains the same. The next symbol is b. As it is an operand, it is sent to the output. So the output consists of a, b. The stack consists of bracket and plus. The next symbol is the closing bracket. At this stage, if we push the closing bracket on the stack, it completes the whole bracket. So we need to pop the elements which are there in the bracket and place the popped elements to the output. So after popping, the stack remains empty and the output contains a, b plus. The next symbol is the multiplication operator. We need to push it on the stack. The output remains the same. The next symbol is c. As it is an operand, it is sent to the output. So the output is a, b plus c. Stack remains the same. Now we have reached to the end of the input. So at this stage, we need to pop all the elements from the stack and place it to the output. So the output consists of a, b plus c multiplication operator. So at this stage, the stack is empty. So the final postfix expression is a, b plus c into. Try to think an answer to convert the infix expression x plus y minus z to postfix form. Here we are trying to convert the infix expression x plus y minus z to postfix form. The first symbol is x. As it is an operand, we need to send it to the output. At this stage, the stack is empty. The next symbol is plus. As it is an operator, it is pushed on the stack. The output remains the same, that is x. The next symbol is y. As it is an operand, it is sent to the output. So the output contains x, y. The stack remains the same, that is plus. The next operator is minus. As we already know, that stack is already having a plus operator. If suppose minus is also pushed on the stack, then plus and minus will have equal precedence. And that is not allowed. So first we need to pop the plus and place it out to the output. And then push the minus operator on the stack. The next symbol is z. As it is an operand, send it to the output. So the output contains x, y plus z. The stack remains the same, that is minus. Now there is end of input. So we need to pop all the elements from the stack. So the output contains x, y plus z minus. At this stage, the stack is empty. So the final postfix expression is x, y plus z minus. These are my references. Thank you.