title
3.9 Evaluation of Prefix and Postfix expressions using Stack | Data Structures
description
In this lecture I have described how we can evaluate prefix and postfix expressions efficiently using stack data structure.
DSA Full Course: https: https://www.youtube.com/playlist?list=PLdo5W4Nhv31bbKJzrsKfMpo_grxuLl8LU
*********************************************
See Complete Playlists:
C Programming Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31a8UcMN9-35ghv8qyFWD9_S
C++ Programming: https://www.youtube.com/playlist?list=PLdo5W4Nhv31YU5Wx1dopka58teWP9aCee
Python Full Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31bZSiqiOL5ta39vSnBxpOPT
Printing Pattern in C: https://www.youtube.com/playlist?list=PLdo5W4Nhv31Yu1igxTE2x0aeShbKtVcCy
DAA Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31ZTn2P9vF02bkb3SC8uiUUn
Placement Series: https://www.youtube.com/playlist?list=PLdo5W4Nhv31YvlDpJhvOYbM9Ap8UypgEy
Dynamic Programming: https://www.youtube.com/playlist?list=PLdo5W4Nhv31aBrJE1WS4MR9LRfbmZrAQu
Operating Systems: //www.youtube.com/playlist?list=PLdo5W4Nhv31a5ucW_S1K3-x6ztBRD-PNa
DBMS: https://www.youtube.com/playlist?list=PLdo5W4Nhv31b33kF46f9aFjoJPOkdlsRc
***********************************************
Connect & Contact Me:
Facebook: https://www.facebook.com/Jennys-Lectures-CSIT-Netjrf-316814368950701/
Quora: https://www.quora.com/profile/Jayanti-Khatri-Lamba
Instagram: https://www.instagram.com/jayantikhatrilamba/
detail
{'title': '3.9 Evaluation of Prefix and Postfix expressions using Stack | Data Structures', 'heatmap': [{'end': 130.08, 'start': 96.431, 'weight': 1}, {'end': 749.573, 'start': 717.373, 'weight': 0.952}, {'end': 810.246, 'start': 769.46, 'weight': 0.719}], 'summary': 'Covers methods for converting, evaluating, and defining prefix and postfix notations, emphasizing the use of a stack for efficient evaluation, showcasing examples resulting in values like 12, 4, and 2, and highlighting the impact of operand position reversal on arithmetic operations.', 'chapters': [{'end': 88.527, 'segs': [{'end': 27.457, 'src': 'embed', 'start': 0.269, 'weight': 0, 'content': [{'end': 4.952, 'text': 'In this lecture, we are going to talk about evaluation of prefix and postfix expressions.', 'start': 0.269, 'duration': 4.683}, {'end': 9.055, 'text': 'See, I have already uploaded a video on evaluation of postfix expression.', 'start': 5.192, 'duration': 3.863}, {'end': 13.838, 'text': 'In that video, I have discussed evaluation of postfix expression using stack, right.', 'start': 9.635, 'duration': 4.203}, {'end': 22.983, 'text': 'In this video, I will discuss both method without using stack as well as using stack, how you can evaluate prefix and postfix expressions, right.', 'start': 14.278, 'duration': 8.705}, {'end': 25.196, 'text': 'i am taking.', 'start': 24.676, 'duration': 0.52}, {'end': 27.457, 'text': 'suppose this is our infix expression.', 'start': 25.196, 'duration': 2.261}], 'summary': 'The lecture covers evaluating prefix and postfix expressions using stack and without stack.', 'duration': 27.188, 'max_score': 0.269, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8269.jpg'}], 'start': 0.269, 'title': 'Evaluation of prefix and postfix expressions', 'summary': 'Covers methods for converting, evaluating, and defining prefix and postfix notations, providing a comprehensive understanding of these expressions.', 'chapters': [{'end': 88.527, 'start': 0.269, 'title': 'Evaluation of prefix and postfix expressions', 'summary': 'Covers the evaluation of prefix and postfix expressions, discussing methods for converting, evaluating, and defining prefix and postfix notations.', 'duration': 88.258, 'highlights': ['The chapter covers the evaluation of prefix and postfix expressions The lecture discusses methods for converting, evaluating, and defining prefix and postfix notations.', 'Methods for converting infix to prefix and postfix expressions The video explains the process of converting infix expressions to prefix and postfix notations, with a reference to a previous video on the topic.', 'Discussion on evaluating prefix and postfix expressions using stack The video covers the evaluation of prefix and postfix expressions using stack, providing a detailed explanation of the process.']}], 'duration': 88.258, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8269.jpg', 'highlights': ['The video covers the evaluation of prefix and postfix expressions using stack, providing a detailed explanation of the process.', 'The chapter covers the evaluation of prefix and postfix expressions The lecture discusses methods for converting, evaluating, and defining prefix and postfix notations.', 'Methods for converting infix to prefix and postfix expressions The video explains the process of converting infix expressions to prefix and postfix notations, with a reference to a previous video on the topic.']}, {'end': 374.663, 'segs': [{'end': 249.153, 'src': 'heatmap', 'start': 96.431, 'weight': 0, 'content': [{'end': 106.257, 'text': "fine, now the first step to evaluate this expression is what without stack i'm going to discuss first, right, scan this expression from right to left.", 'start': 96.431, 'duration': 9.826}, {'end': 113.008, 'text': 'in case of prefix, we scan it from right to left and in case of postfix, we scan the expression from left to right.', 'start': 107, 'duration': 6.008}, {'end': 119.777, 'text': 'right now, scan it from right to left and find out the first operator.', 'start': 113.008, 'duration': 6.769}, {'end': 130.08, 'text': 'so while scanning the first operator is this one, after this operator find out the two operand immediately next to this operand.', 'start': 119.777, 'duration': 10.303}, {'end': 133.844, 'text': 'so after this operand first, after this operator, first operand is two.', 'start': 130.08, 'duration': 3.764}, {'end': 136.106, 'text': 'another operand is three.', 'start': 133.844, 'duration': 2.262}, {'end': 138.007, 'text': 'it means we first.', 'start': 136.106, 'duration': 1.901}, {'end': 147.915, 'text': 'or you can say you have to find out this pattern, operator and operand and operand right.', 'start': 138.007, 'duration': 9.908}, {'end': 154.051, 'text': 'once you find out this pattern, you can evaluate that thing.', 'start': 150.367, 'duration': 3.684}, {'end': 160.577, 'text': 'fine. so while scanning first operator is this one, find out just after this operator the two operand.', 'start': 154.051, 'duration': 6.526}, {'end': 161.238, 'text': 'one is this one.', 'start': 160.577, 'duration': 0.661}, {'end': 162.379, 'text': 'one is this one.', 'start': 161.238, 'duration': 1.141}, {'end': 165.943, 'text': 'so for this operator, you can say these are two operands.', 'start': 162.379, 'duration': 3.564}, {'end': 171.03, 'text': 'fine. so this is a prefix expression.', 'start': 167.128, 'duration': 3.902}, {'end': 175.533, 'text': 'right, you can say within this prefix, one prefix is this one.', 'start': 171.03, 'duration': 4.503}, {'end': 177.935, 'text': 'so first of all, evaluate this one.', 'start': 175.533, 'duration': 2.402}, {'end': 179.776, 'text': 'now how to evaluate this one.', 'start': 177.935, 'duration': 1.841}, {'end': 180.976, 'text': 'see for this.', 'start': 179.776, 'duration': 1.2}, {'end': 193.334, 'text': 'for this, see this, the first operand, how you will write the first operand, then the operator and then the second operand Means in fixed form.', 'start': 180.976, 'duration': 12.358}, {'end': 194.996, 'text': 'this prefix means this one 2.', 'start': 193.334, 'duration': 1.662}, {'end': 195.878, 'text': 'raised to power 3..', 'start': 194.996, 'duration': 0.882}, {'end': 196.559, 'text': 'This is power.', 'start': 195.878, 'duration': 0.681}, {'end': 199.163, 'text': '2 raised to power 3 means 8.', 'start': 196.579, 'duration': 2.584}, {'end': 201.927, 'text': 'Right So here what you will write down 8.', 'start': 199.163, 'duration': 2.764}, {'end': 205.172, 'text': 'After evaluation this would become 8.', 'start': 201.927, 'duration': 3.245}, {'end': 207.035, 'text': 'So now the expression is something like this.', 'start': 205.172, 'duration': 1.863}, {'end': 210.961, 'text': 'fine for this.', 'start': 208.7, 'duration': 2.261}, {'end': 213.022, 'text': 'i have written eight right.', 'start': 210.961, 'duration': 2.061}, {'end': 220.045, 'text': 'i have evaluated this one now again, find again, scan from right to left and find out the first operator.', 'start': 213.022, 'duration': 7.023}, {'end': 224.787, 'text': 'so while scanning from right to left, now the first operator is this divide.', 'start': 220.045, 'duration': 4.742}, {'end': 231.91, 'text': 'fine, now, if your this prefix expression is valid, then definitely you will get two operand.', 'start': 224.787, 'duration': 7.123}, {'end': 240.927, 'text': 'after this, maybe two or three, three, four more operands can be there, but you need to find out next two, immediate next two.', 'start': 231.91, 'duration': 9.017}, {'end': 245.811, 'text': 'suppose here one and two is also there, or you can say two and three are also there.', 'start': 240.927, 'duration': 4.884}, {'end': 249.153, 'text': 'but for this, how you are going to evaluate this one.', 'start': 245.811, 'duration': 3.342}], 'summary': "The transcript discusses evaluating a prefix expression by scanning from right to left, finding operators and operands, and calculating the result. it provides an example of evaluating the expression '2 raised to power 3', resulting in 8.", 'duration': 160.626, 'max_score': 96.431, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h896431.jpg'}], 'start': 88.527, 'title': 'Evaluating prefix expressions', 'summary': 'Discusses evaluating prefix expressions using binary operators and prefix evaluation, emphasizing the process of scanning from right to left, identifying operator and operands pattern, and performing evaluation without a stack.', 'chapters': [{'end': 224.787, 'start': 88.527, 'title': 'Binary operators and prefix evaluation', 'summary': 'Discusses the evaluation of a prefix expression using binary operators, scanning the expression from right to left, and identifying the pattern of operator and operands to evaluate the expression.', 'duration': 136.26, 'highlights': ['The first step to evaluate a prefix expression is to scan it from right to left, identifying the first operator and the two operands immediately next to it. This approach allows for the systematic evaluation of a prefix expression by identifying the first operator and its corresponding two operands while scanning the expression from right to left.', "In the given example, the prefix expression '2 raised to power 3' is evaluated, resulting in the value of 8. The specific example demonstrates the evaluation of the prefix expression '2 raised to power 3', which yields the value of 8 through the systematic application of the operator and operands.", 'The process involves continuously scanning from right to left to identify the next operator and carry out the corresponding evaluation. The iterative process of scanning from right to left allows for the continuous identification of operators and the subsequent evaluation of the operands, contributing to the comprehensive assessment of the prefix expression.']}, {'end': 374.663, 'start': 224.787, 'title': 'Evaluating prefix expressions', 'summary': 'Explains the process of evaluating prefix expressions, highlighting the identification of operators, operands, and their immediate next pairs, and the method to perform the evaluation without using a stack.', 'duration': 149.876, 'highlights': ['The chapter emphasizes the importance of identifying the immediate next two operands after an operator in a prefix expression, as failure to do so can render the expression invalid.', 'It explains the evaluation process by demonstrating examples, such as 16 divided by 8 resulting in 2, and 3 multiplied by 4 resulting in 12, providing clarity on the step-by-step calculation method.', 'The chapter concludes with the successful evaluation of a prefix expression without utilizing a stack, showcasing the practical application of the evaluation process.']}], 'duration': 286.136, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h888527.jpg', 'highlights': ['The process involves continuously scanning from right to left to identify the next operator and carry out the corresponding evaluation.', "The specific example demonstrates the evaluation of the prefix expression '2 raised to power 3', which yields the value of 8 through the systematic application of the operator and operands.", 'The chapter emphasizes the importance of identifying the immediate next two operands after an operator in a prefix expression, as failure to do so can render the expression invalid.', 'It explains the evaluation process by demonstrating examples, such as 16 divided by 8 resulting in 2, and 3 multiplied by 4 resulting in 12, providing clarity on the step-by-step calculation method.', 'The chapter concludes with the successful evaluation of a prefix expression without utilizing a stack, showcasing the practical application of the evaluation process.', 'The first step to evaluate a prefix expression is to scan it from right to left, identifying the first operator and the two operands immediately next to it. This approach allows for the systematic evaluation of a prefix expression by identifying the first operator and its corresponding two operands while scanning the expression from right to left.']}, {'end': 717.313, 'segs': [{'end': 446.896, 'src': 'embed', 'start': 375.043, 'weight': 0, 'content': [{'end': 380.706, 'text': 'But in this case the problem is what? You have to scan this expression multiple times.', 'start': 375.043, 'duration': 5.663}, {'end': 385.769, 'text': 'In one scan I got this value that is that 8 value.', 'start': 381.227, 'duration': 4.542}, {'end': 390.452, 'text': 'In another scan for this divide you have evaluated another scan then another scan something like this.', 'start': 385.829, 'duration': 4.623}, {'end': 394.045, 'text': 'fine. so this is, you can say, time consuming process.', 'start': 391.343, 'duration': 2.702}, {'end': 399.47, 'text': 'now another thing is i want in one scan only i want to evaluate the prefix expression.', 'start': 394.045, 'duration': 5.425}, {'end': 404.914, 'text': 'i need to scan only once this expression from right to left and i get the value 12 now.', 'start': 399.47, 'duration': 5.444}, {'end': 406.796, 'text': 'that thing you can do with stack.', 'start': 404.914, 'duration': 1.882}, {'end': 411.96, 'text': 'now, how you will evaluate this prefix expression using stack, that thing we will discuss now.', 'start': 406.796, 'duration': 5.164}, {'end': 413.921, 'text': 'so now this is the stack i have taken.', 'start': 411.96, 'duration': 1.961}, {'end': 416.583, 'text': 'fine, you have to create a stack right now.', 'start': 413.921, 'duration': 2.662}, {'end': 427.472, 'text': 'first step is start scanning the prefix expression from right to left and now, if you found you find the operand,', 'start': 417.424, 'duration': 10.048}, {'end': 431.615, 'text': 'then simply push that operand into the stack right.', 'start': 427.472, 'duration': 4.143}, {'end': 434.237, 'text': 'so now, see, start scanning.', 'start': 431.615, 'duration': 2.622}, {'end': 435.799, 'text': 'first of all, we have three.', 'start': 434.237, 'duration': 1.562}, {'end': 436.719, 'text': 'this is operand.', 'start': 435.799, 'duration': 0.92}, {'end': 439.942, 'text': 'simply push it into the stack again.', 'start': 436.719, 'duration': 3.223}, {'end': 441.163, 'text': 'two, this is also operand.', 'start': 439.942, 'duration': 1.221}, {'end': 442.424, 'text': 'simply push it into the stack.', 'start': 441.163, 'duration': 1.261}, {'end': 446.896, 'text': 'next is what operator now you need to do what?', 'start': 443.374, 'duration': 3.522}], 'summary': 'Scanning prefix expression using stack for efficient evaluation.', 'duration': 71.853, 'max_score': 375.043, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8375043.jpg'}, {'end': 643.961, 'src': 'embed', 'start': 613.083, 'weight': 2, 'content': [{'end': 613.923, 'text': 'this is operand.', 'start': 613.083, 'duration': 0.84}, {'end': 615.344, 'text': 'simply push it into the stack.', 'start': 613.923, 'duration': 1.421}, {'end': 616.745, 'text': 'after this we have plus.', 'start': 615.344, 'duration': 1.401}, {'end': 620.767, 'text': 'this is what operator now you need to do what push 2 operand.', 'start': 616.745, 'duration': 4.022}, {'end': 622.628, 'text': 'first operand would be 2.', 'start': 620.767, 'duration': 1.861}, {'end': 625.47, 'text': 'second operand would be 12..', 'start': 622.628, 'duration': 2.842}, {'end': 627.111, 'text': 'now, operator is plus.', 'start': 625.47, 'duration': 1.641}, {'end': 628.532, 'text': 'so what you need to do?', 'start': 627.111, 'duration': 1.421}, {'end': 629.572, 'text': '2 plus 12.', 'start': 628.532, 'duration': 1.04}, {'end': 636.436, 'text': 'evaluate this one that is 14 and push this result into the stack that is 14.', 'start': 629.572, 'duration': 6.864}, {'end': 637.757, 'text': 'after this, we have minus.', 'start': 636.436, 'duration': 1.321}, {'end': 638.878, 'text': 'this is also operator.', 'start': 637.757, 'duration': 1.121}, {'end': 640.799, 'text': 'no need to push anything now.', 'start': 638.878, 'duration': 1.921}, {'end': 643.961, 'text': 'pop out the two operands from the stack now.', 'start': 640.799, 'duration': 3.162}], 'summary': 'Arithmetic operations performed on stack: push, evaluate, pop.', 'duration': 30.878, 'max_score': 613.083, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8613083.jpg'}], 'start': 375.043, 'title': 'Evaluating prefix expression using stack', 'summary': 'Discusses evaluating prefix expressions using a stack to reduce scanning times, demonstrating single-scan evaluation resulting in the value 12, and showcases the efficiency of using a stack for evaluation, with examples of values like 12, 4, and 2.', 'chapters': [{'end': 505.001, 'start': 375.043, 'title': 'Evaluating prefix expression using stack', 'summary': 'Discusses evaluating a prefix expression using a stack, aiming to reduce the time-consuming process of scanning multiple times and demonstrating the steps to evaluate the expression in a single scan, resulting in the value 12.', 'duration': 129.958, 'highlights': ['The process of scanning an expression multiple times is time-consuming, and the goal is to evaluate the prefix expression in a single scan, resulting in the value 12.', 'The approach involves using a stack to evaluate the prefix expression from right to left, pushing operands onto the stack and then popping out two operands at a time to perform the corresponding operation.']}, {'end': 613.083, 'start': 505.001, 'title': 'Stack evaluation process', 'summary': 'Discusses the process of evaluating arithmetic expressions using a stack, including pushing and popping operands and operators, resulting in values like 12, 4, and 2.', 'duration': 108.082, 'highlights': ['The operand evaluation process involves pushing and popping values from the stack, such as pushing 8, 16, and 2 after evaluating expressions like 2^3 and 16/8.', 'Demonstrates the process of pushing and popping operands and operators from the stack, resulting in the value 12 after evaluating the expression 3*4.', 'Defines the process of pushing and popping operands and operators to evaluate arithmetic expressions, resulting in the value 2 after evaluating the expression 16/8.']}, {'end': 717.313, 'start': 613.083, 'title': 'Prefix expression evaluation', 'summary': 'Explains the evaluation of a prefix expression using a stack, demonstrating the process of pushing operands, applying operators, and evaluating the final result, ultimately returning the correct result of 12, showcasing the efficiency of using a stack for evaluation.', 'duration': 104.23, 'highlights': ['The chapter explains the evaluation of a prefix expression using a stack It provides a clear understanding of the process of evaluating a prefix expression using a stack as the underlying data structure.', 'returning the correct result of 12 The evaluation of the prefix expression results in the correct output of 12, demonstrating the successful application of the evaluation process.', 'showcasing the efficiency of using a stack for evaluation The use of a stack for evaluating the prefix expression is highlighted as an efficient approach compared to scanning the expression multiple times, emphasizing the benefits of utilizing the stack.']}], 'duration': 342.27, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8375043.jpg', 'highlights': ['The process of scanning an expression multiple times is time-consuming, and the goal is to evaluate the prefix expression in a single scan, resulting in the value 12.', 'The approach involves using a stack to evaluate the prefix expression from right to left, pushing operands onto the stack and then popping out two operands at a time to perform the corresponding operation.', 'Demonstrates the process of pushing and popping operands and operators from the stack, resulting in the value 12 after evaluating the expression 3*4.', 'The chapter explains the evaluation of a prefix expression using a stack It provides a clear understanding of the process of evaluating a prefix expression using a stack as the underlying data structure.', 'showcasing the efficiency of using a stack for evaluation The use of a stack for evaluating the prefix expression is highlighted as an efficient approach compared to scanning the expression multiple times, emphasizing the benefits of utilizing the stack.']}, {'end': 1024.102, 'segs': [{'end': 749.573, 'src': 'embed', 'start': 717.373, 'weight': 0, 'content': [{'end': 721.136, 'text': 'Programmatically when you evaluate this thing then we use stack.', 'start': 717.373, 'duration': 3.763}, {'end': 724.339, 'text': 'So now the algorithm for this thing is C.', 'start': 721.517, 'duration': 2.822}, {'end': 725.48, 'text': 'So this is the algorithm.', 'start': 724.339, 'duration': 1.141}, {'end': 728.824, 'text': 'First step is scan the prefix expression from right to left.', 'start': 725.881, 'duration': 2.943}, {'end': 736.009, 'text': 'You can write down here a for loop, that is for i is equal to, from length minus 1 to 0.', 'start': 729.624, 'duration': 6.385}, {'end': 738.45, 'text': 'till then you are going to scan that expression.', 'start': 736.009, 'duration': 2.441}, {'end': 741.531, 'text': 'fine, for each character in the prefix expression.', 'start': 738.45, 'duration': 3.081}, {'end': 742.851, 'text': 'what you need to do?', 'start': 741.531, 'duration': 1.32}, {'end': 749.573, 'text': 'in a loop you will write, if operand is there, what we have done, simply push it on onto the stack if operator is there.', 'start': 742.851, 'duration': 6.722}], 'summary': 'Algorithm c scans prefix expression from right to left using a for loop.', 'duration': 32.2, 'max_score': 717.373, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8717373.jpg'}, {'end': 749.573, 'src': 'heatmap', 'start': 717.373, 'weight': 0.952, 'content': [{'end': 721.136, 'text': 'Programmatically when you evaluate this thing then we use stack.', 'start': 717.373, 'duration': 3.763}, {'end': 724.339, 'text': 'So now the algorithm for this thing is C.', 'start': 721.517, 'duration': 2.822}, {'end': 725.48, 'text': 'So this is the algorithm.', 'start': 724.339, 'duration': 1.141}, {'end': 728.824, 'text': 'First step is scan the prefix expression from right to left.', 'start': 725.881, 'duration': 2.943}, {'end': 736.009, 'text': 'You can write down here a for loop, that is for i is equal to, from length minus 1 to 0.', 'start': 729.624, 'duration': 6.385}, {'end': 738.45, 'text': 'till then you are going to scan that expression.', 'start': 736.009, 'duration': 2.441}, {'end': 741.531, 'text': 'fine, for each character in the prefix expression.', 'start': 738.45, 'duration': 3.081}, {'end': 742.851, 'text': 'what you need to do?', 'start': 741.531, 'duration': 1.32}, {'end': 749.573, 'text': 'in a loop you will write, if operand is there, what we have done, simply push it on onto the stack if operator is there.', 'start': 742.851, 'duration': 6.722}], 'summary': 'The algorithm for evaluating a prefix expression involves scanning from right to left and pushing operands onto a stack.', 'duration': 32.2, 'max_score': 717.373, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8717373.jpg'}, {'end': 810.246, 'src': 'heatmap', 'start': 769.46, 'weight': 0.719, 'content': [{'end': 772.32, 'text': 'right, and you are going to repeat these steps.', 'start': 769.46, 'duration': 2.86}, {'end': 777.022, 'text': 'fine, because this you are going to write down in a loop from length minus 1 to 0.', 'start': 772.32, 'duration': 4.702}, {'end': 780.163, 'text': 'once the i value becomes 0, simply you will return the stack top.', 'start': 777.022, 'duration': 3.141}, {'end': 782.035, 'text': 'this is it.', 'start': 781.055, 'duration': 0.98}, {'end': 783.176, 'text': 'this is the algorithm.', 'start': 782.035, 'duration': 1.141}, {'end': 787.718, 'text': 'now we will see manually how you will evaluate a post fix expression.', 'start': 783.176, 'duration': 4.542}, {'end': 791.499, 'text': 'right, we have already discussed, using stack, how you can evaluate that thing.', 'start': 787.718, 'duration': 3.781}, {'end': 792.819, 'text': 'the same example i am taking.', 'start': 791.499, 'duration': 1.32}, {'end': 793.64, 'text': 'this is the example.', 'start': 792.819, 'duration': 0.821}, {'end': 798.982, 'text': 'this is the post fix expression for this infix expression how to convert infix to post fix.', 'start': 793.64, 'duration': 5.342}, {'end': 800.222, 'text': 'that thing also i have discussed.', 'start': 798.982, 'duration': 1.24}, {'end': 803.543, 'text': 'you can check out that video in this i button right after conversion.', 'start': 800.222, 'duration': 3.321}, {'end': 807.065, 'text': 'this is the post fix expression and after substituting the value for these variable.', 'start': 803.543, 'duration': 3.522}, {'end': 808.545, 'text': 'now this is the post fix expression.', 'start': 807.065, 'duration': 1.48}, {'end': 810.246, 'text': 'now you have to find out the value of this one.', 'start': 808.545, 'duration': 1.701}], 'summary': 'The algorithm evaluates a post fix expression using a stack, as discussed in the video.', 'duration': 40.786, 'max_score': 769.46, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8769460.jpg'}, {'end': 811.787, 'src': 'embed', 'start': 782.035, 'weight': 1, 'content': [{'end': 783.176, 'text': 'this is the algorithm.', 'start': 782.035, 'duration': 1.141}, {'end': 787.718, 'text': 'now we will see manually how you will evaluate a post fix expression.', 'start': 783.176, 'duration': 4.542}, {'end': 791.499, 'text': 'right, we have already discussed, using stack, how you can evaluate that thing.', 'start': 787.718, 'duration': 3.781}, {'end': 792.819, 'text': 'the same example i am taking.', 'start': 791.499, 'duration': 1.32}, {'end': 793.64, 'text': 'this is the example.', 'start': 792.819, 'duration': 0.821}, {'end': 798.982, 'text': 'this is the post fix expression for this infix expression how to convert infix to post fix.', 'start': 793.64, 'duration': 5.342}, {'end': 800.222, 'text': 'that thing also i have discussed.', 'start': 798.982, 'duration': 1.24}, {'end': 803.543, 'text': 'you can check out that video in this i button right after conversion.', 'start': 800.222, 'duration': 3.321}, {'end': 807.065, 'text': 'this is the post fix expression and after substituting the value for these variable.', 'start': 803.543, 'duration': 3.522}, {'end': 808.545, 'text': 'now this is the post fix expression.', 'start': 807.065, 'duration': 1.48}, {'end': 810.246, 'text': 'now you have to find out the value of this one.', 'start': 808.545, 'duration': 1.701}, {'end': 811.787, 'text': 'you have to evaluate this one.', 'start': 810.626, 'duration': 1.161}], 'summary': 'The transcript discusses evaluating a postfix expression using a stack and provides examples.', 'duration': 29.752, 'max_score': 782.035, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8782035.jpg'}, {'end': 856.458, 'src': 'embed', 'start': 824.215, 'weight': 3, 'content': [{'end': 827.916, 'text': 'Binary operator I am talking about means operand, operand and after that operator.', 'start': 824.215, 'duration': 3.701}, {'end': 835.259, 'text': 'For this operator, these two are the operands, right? Now, in this case, you need to scan it from left to right only.', 'start': 827.956, 'duration': 7.303}, {'end': 839.74, 'text': 'Almost same algorithm we have, evaluation of prefix and postfix.', 'start': 835.539, 'duration': 4.201}, {'end': 842.961, 'text': 'This is what? Evaluation of postfix.', 'start': 840.3, 'duration': 2.661}, {'end': 847.182, 'text': 'I am discussing here, right? Now, see.', 'start': 844.001, 'duration': 3.181}, {'end': 849.243, 'text': 'Scan it from left to right.', 'start': 848.083, 'duration': 1.16}, {'end': 856.458, 'text': 'find out the first operator as soon as you find out the first operator, that is.', 'start': 851.615, 'duration': 4.843}], 'summary': 'Discussion on evaluating postfix expressions and scanning from left to right.', 'duration': 32.243, 'max_score': 824.215, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8824215.jpg'}], 'start': 717.373, 'title': 'Evaluating prefix and postfix expressions', 'summary': 'Outlines the algorithm for evaluating prefix expressions using a stack and a step-by-step process, along with discussing the evaluation of postfix expressions without using a stack and illustrating the process with an example.', 'chapters': [{'end': 822.675, 'start': 717.373, 'title': 'Algorithm for evaluating prefix expressions', 'summary': 'Outlines the algorithm for evaluating prefix expressions, emphasizing the use of stack data structure and the step-by-step process of scanning, pushing, popping, and evaluating operands and operators within a loop.', 'duration': 105.302, 'highlights': ['The algorithm involves scanning the prefix expression from right to left using a loop from length minus 1 to 0, pushing operands onto the stack and popping and evaluating operators and operands to store the result in a variable, repeating these steps until reaching the end of the expression.', 'The process of evaluating a post fix expression involves substituting the values for the variables, identifying the pattern of operand, operand, and operator, and using stack data structure for the evaluation.']}, {'end': 1024.102, 'start': 824.215, 'title': 'Evaluation of postfix expressions', 'summary': "Discusses the evaluation of postfix expressions without using a stack, emphasizing the process of scanning from left to right and finding the operator's two preceding operands to compute the result, illustrating with an example of evaluating a postfix expression step by step.", 'duration': 199.887, 'highlights': ["The process of scanning from left to right and finding the operator's two preceding operands to compute the result is emphasized. The chapter focuses on the importance of scanning from left to right and identifying the two preceding operands of an operator to compute the result in the evaluation of postfix expressions.", 'Illustration of evaluating a postfix expression step by step with an example, demonstrating the computation of the result for each operator encountered during the scan. The discussion includes a step-by-step example of evaluating a postfix expression, demonstrating the computation of the result for each operator encountered during the scanning process.', "Explanation of the evaluation process without using a stack, highlighting the simplicity and effectiveness of the described method. The chapter explains the process of evaluating postfix expressions without using a stack, underscoring the simplicity and effectiveness of the described method in computing the expression's result."]}], 'duration': 306.729, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h8717373.jpg', 'highlights': ['The algorithm involves scanning the prefix expression from right to left using a loop from length minus 1 to 0, pushing operands onto the stack and popping and evaluating operators and operands to store the result in a variable, repeating these steps until reaching the end of the expression.', 'The process of evaluating a post fix expression involves substituting the values for the variables, identifying the pattern of operand, operand, and operator, and using stack data structure for the evaluation.', 'Illustration of evaluating a postfix expression step by step with an example, demonstrating the computation of the result for each operator encountered during the scan. The discussion includes a step-by-step example of evaluating a postfix expression, demonstrating the computation of the result for each operator encountered during the scanning process.', "The process of scanning from left to right and finding the operator's two preceding operands to compute the result is emphasized. The chapter focuses on the importance of scanning from left to right and identifying the two preceding operands of an operator to compute the result in the evaluation of postfix expressions.", "Explanation of the evaluation process without using a stack, highlighting the simplicity and effectiveness of the described method. The chapter explains the process of evaluating postfix expressions without using a stack, underscoring the simplicity and effectiveness of the described method in computing the expression's result."]}, {'end': 1262.55, 'segs': [{'end': 1055.013, 'src': 'embed', 'start': 1024.222, 'weight': 0, 'content': [{'end': 1026.404, 'text': 'If operand, you will find push it into the stack.', 'start': 1024.222, 'duration': 2.182}, {'end': 1028.984, 'text': 'Means here we have two, simply push it into the stack.', 'start': 1026.444, 'duration': 2.54}, {'end': 1031.267, 'text': 'Next is three, simply push it into the stack.', 'start': 1029.285, 'duration': 1.982}, {'end': 1033.848, 'text': 'Next is four, simply push it into the stack.', 'start': 1031.906, 'duration': 1.942}, {'end': 1036.23, 'text': 'Next is multiplication.', 'start': 1034.608, 'duration': 1.622}, {'end': 1040.192, 'text': 'Now you need to pop out two elements from the stack right?', 'start': 1036.31, 'duration': 3.882}, {'end': 1045.635, 'text': 'But here the slight difference from the evaluation of prefix is what?', 'start': 1040.632, 'duration': 5.003}, {'end': 1049.178, 'text': 'Here, when you pop out this four, it means', 'start': 1046.136, 'duration': 3.042}, {'end': 1055.013, 'text': 'it is operand 2, not operand 1.', 'start': 1050.347, 'duration': 4.666}], 'summary': 'Operands pushed into stack, then multiplication. difference in operand popping.', 'duration': 30.791, 'max_score': 1024.222, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h81024222.jpg'}, {'end': 1137.805, 'src': 'embed', 'start': 1079.87, 'weight': 2, 'content': [{'end': 1082.171, 'text': 'slight difference is this thing only.', 'start': 1079.87, 'duration': 2.301}, {'end': 1087.273, 'text': 'this would be operand two, this one and this would be operand one.', 'start': 1082.171, 'duration': 5.102}, {'end': 1087.873, 'text': 'just reverse.', 'start': 1087.273, 'duration': 0.6}, {'end': 1092.569, 'text': 'right means here 3 into 4.', 'start': 1088.686, 'duration': 3.883}, {'end': 1094.731, 'text': 'operator is this one, 3 into 4.', 'start': 1092.569, 'duration': 2.162}, {'end': 1098.374, 'text': 'and here also here also same thing we have done, that is 12.', 'start': 1094.731, 'duration': 3.643}, {'end': 1105.34, 'text': 'see, in multiplication, there would be no problem if you write 4 into 3 or 3 into 4, but in case of divide it would create a problem.', 'start': 1098.374, 'duration': 6.966}, {'end': 1107.342, 'text': 'so you need to take care of these rules.', 'start': 1105.34, 'duration': 2.002}, {'end': 1110.705, 'text': 'in case of minus also, it would create a problem.', 'start': 1107.342, 'duration': 3.363}, {'end': 1113.347, 'text': 'now, see, simply push.', 'start': 1110.705, 'duration': 2.642}, {'end': 1115.108, 'text': 'this result here means 12.', 'start': 1113.347, 'duration': 1.761}, {'end': 1116.69, 'text': 'so simply push this 12 here.', 'start': 1115.108, 'duration': 1.582}, {'end': 1118.957, 'text': 'Now, next is plus.', 'start': 1117.475, 'duration': 1.482}, {'end': 1120.439, 'text': 'this is also operator.', 'start': 1118.957, 'duration': 1.482}, {'end': 1122.582, 'text': 'so pop out 2 operand.', 'start': 1120.439, 'duration': 2.143}, {'end': 1128.69, 'text': 'So here in this case now operand 2 is what? 12.', 'start': 1122.943, 'duration': 5.747}, {'end': 1132.438, 'text': 'Operand 1 is what? 2.', 'start': 1128.69, 'duration': 3.748}, {'end': 1137.805, 'text': 'So now operand 1 that is 2, operator is plus and here we have 12 means 14.', 'start': 1132.438, 'duration': 5.367}], 'summary': 'Demonstration of arithmetic operations and stack manipulation with an example resulting in 14.', 'duration': 57.935, 'max_score': 1079.87, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h81079870.jpg'}, {'end': 1258.466, 'src': 'embed', 'start': 1226.963, 'weight': 1, 'content': [{'end': 1229.224, 'text': 'now we have reached till the end of the expression.', 'start': 1226.963, 'duration': 2.261}, {'end': 1235.666, 'text': 'now, if in the stack i have only one value and here you can see, here we have only one value, now return the top of the stack,', 'start': 1229.224, 'duration': 6.442}, {'end': 1241.329, 'text': 'that is 12 you are going to return means the result is 12 and we have found the same result.', 'start': 1235.666, 'duration': 5.663}, {'end': 1243.391, 'text': 'so i guess algorithm you can easily write down.', 'start': 1241.329, 'duration': 2.062}, {'end': 1245.673, 'text': 'or for algorithm you can check out this video.', 'start': 1243.391, 'duration': 2.282}, {'end': 1253.121, 'text': 'in this i button see, we can also represent this infix expression into a tree form, binary tree form.', 'start': 1245.673, 'duration': 7.448}, {'end': 1258.466, 'text': 'how we are going to represent this thing into a tree form, how you can create that expression tree.', 'start': 1253.121, 'duration': 5.345}], 'summary': 'The algorithm can be easily written down for the given expression, returning a result of 12, and can also be represented in a tree form.', 'duration': 31.503, 'max_score': 1226.963, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h81226963.jpg'}], 'start': 1024.222, 'title': 'Evaluation of prefix expressions', 'summary': 'Explains the evaluation of prefix expressions using a stack, highlighting the reversal of operand positions and its impact on the result in arithmetic operations. it also demonstrates an example of stack operations, including push, pop, and calculation of postfix expression, resulting in the final value of 12.', 'chapters': [{'end': 1105.34, 'start': 1024.222, 'title': 'Evaluation of prefix expressions', 'summary': 'Explains the evaluation of prefix expressions using a stack, highlighting the reversal of operand positions and its impact on the result in arithmetic operations.', 'duration': 81.118, 'highlights': ['The evaluation of prefix expressions involves pushing operands into a stack and then performing arithmetic operations based on the reversed order of operands, which impacts the result (e.g., 3*4 results in 12 instead of 4*3).', 'In prefix evaluation, the reversal of operand positions is crucial, as it affects the arithmetic operations and can lead to different results, particularly in division operations.']}, {'end': 1262.55, 'start': 1105.34, 'title': 'Stack operation example', 'summary': 'Demonstrates an example of stack operations, including push, pop, and calculation of postfix expression, resulting in the final value of 12.', 'duration': 157.21, 'highlights': ['The algorithm demonstrates push and pop operations on a stack to process a postfix expression, resulting in the final value of 12.', 'The process involves using operators such as plus, exponent, divide, and minus on operands, leading to the final value of 12.', 'The video mentions the possibility of representing the infix expression into a binary tree form in the next video.']}], 'duration': 238.328, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/o6vj5l_W2h8/pics/o6vj5l_W2h81024222.jpg', 'highlights': ['The evaluation of prefix expressions involves pushing operands into a stack and then performing arithmetic operations based on the reversed order of operands, which impacts the result (e.g., 3*4 results in 12 instead of 4*3).', 'The algorithm demonstrates push and pop operations on a stack to process a postfix expression, resulting in the final value of 12.', 'In prefix evaluation, the reversal of operand positions is crucial, as it affects the arithmetic operations and can lead to different results, particularly in division operations.', 'The process involves using operators such as plus, exponent, divide, and minus on operands, leading to the final value of 12.']}], 'highlights': ['The video covers the evaluation of prefix and postfix expressions using stack, providing a detailed explanation of the process.', 'The chapter covers the evaluation of prefix and postfix expressions The lecture discusses methods for converting, evaluating, and defining prefix and postfix notations.', 'Methods for converting infix to prefix and postfix expressions The video explains the process of converting infix expressions to prefix and postfix notations, with a reference to a previous video on the topic.', 'The process involves continuously scanning from right to left to identify the next operator and carry out the corresponding evaluation.', "The specific example demonstrates the evaluation of the prefix expression '2 raised to power 3', which yields the value of 8 through the systematic application of the operator and operands.", 'The chapter emphasizes the importance of identifying the immediate next two operands after an operator in a prefix expression, as failure to do so can render the expression invalid.', 'It explains the evaluation process by demonstrating examples, such as 16 divided by 8 resulting in 2, and 3 multiplied by 4 resulting in 12, providing clarity on the step-by-step calculation method.', 'The chapter concludes with the successful evaluation of a prefix expression without utilizing a stack, showcasing the practical application of the evaluation process.', 'The first step to evaluate a prefix expression is to scan it from right to left, identifying the first operator and the two operands immediately next to it. This approach allows for the systematic evaluation of a prefix expression by identifying the first operator and its corresponding two operands while scanning the expression from right to left.', 'The process of scanning an expression multiple times is time-consuming, and the goal is to evaluate the prefix expression in a single scan, resulting in the value 12.', 'The approach involves using a stack to evaluate the prefix expression from right to left, pushing operands onto the stack and then popping out two operands at a time to perform the corresponding operation.', 'Demonstrates the process of pushing and popping operands and operators from the stack, resulting in the value 12 after evaluating the expression 3*4.', 'The chapter explains the evaluation of a prefix expression using a stack It provides a clear understanding of the process of evaluating a prefix expression using a stack as the underlying data structure.', 'showcasing the efficiency of using a stack for evaluation The use of a stack for evaluating the prefix expression is highlighted as an efficient approach compared to scanning the expression multiple times, emphasizing the benefits of utilizing the stack.', 'The algorithm involves scanning the prefix expression from right to left using a loop from length minus 1 to 0, pushing operands onto the stack and popping and evaluating operators and operands to store the result in a variable, repeating these steps until reaching the end of the expression.', 'The process of evaluating a post fix expression involves substituting the values for the variables, identifying the pattern of operand, operand, and operator, and using stack data structure for the evaluation.', 'Illustration of evaluating a postfix expression step by step with an example, demonstrating the computation of the result for each operator encountered during the scan. The discussion includes a step-by-step example of evaluating a postfix expression, demonstrating the computation of the result for each operator encountered during the scanning process.', "The process of scanning from left to right and finding the operator's two preceding operands to compute the result is emphasized. The chapter focuses on the importance of scanning from left to right and identifying the two preceding operands of an operator to compute the result in the evaluation of postfix expressions.", "Explanation of the evaluation process without using a stack, highlighting the simplicity and effectiveness of the described method. The chapter explains the process of evaluating postfix expressions without using a stack, underscoring the simplicity and effectiveness of the described method in computing the expression's result.", 'The evaluation of prefix expressions involves pushing operands into a stack and then performing arithmetic operations based on the reversed order of operands, which impacts the result (e.g., 3*4 results in 12 instead of 4*3).', 'The algorithm demonstrates push and pop operations on a stack to process a postfix expression, resulting in the final value of 12.', 'In prefix evaluation, the reversal of operand positions is crucial, as it affects the arithmetic operations and can lead to different results, particularly in division operations.', 'The process involves using operators such as plus, exponent, divide, and minus on operands, leading to the final value of 12.']}