انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة
الكلية كلية العلوم للبنات
القسم قسم الحاسبات
المرحلة 2
أستاذ المادة اسراء عبد الله حسين علي الدليمي
09/04/2017 13:28:17
Expression Representation Techniques : Expression is a collection of operators and operands that represents a specific value. 1.Infix Expression 2.Prefix Expression 3. Postfix Expression Expression Example Note Infix a + b Operator Between Operands Prefix + a b Operator before Operands Postfix a b + Operator after Operands
To evaluate an infix expression we need to consider Operators’ Priority and Associative property. For example expression 3+5*4 evaluate to 32 i.e. (3+5)*4 or to 23 i.e. 3+(5*4). Generally postfix expressions are free from Operator Precedence that s why they are preferred in Computer system. Computer System Uses Postfix form to represent expression.
Explanation the conversion in steps : 1. Read symbol from expression and it may be – o Alphabet from A-Z or a-Z o Numerical Digit from 0-9 o Operator o Opening And Closing Braces ( , ) 2. If Entered Character is Alphabet or Digit then Following Action Should be taken: o Print Alphabet and Digit as Output 3. If Entered Character is Opening Bracket then Following Action Should be taken- o Push ‘(‘ Onto Stack o If any Operator Appears before ‘)’ then Push it onto Stack. o If Corresponding ‘)’ bracket appears then Start Removing Elements [Pop] from Stack till ‘(‘ is removed. 4. If Entered Character is Operator then Following Action Should be taken:: o Check Whether There is any Operator Already present in Stack or not. o If Stack is Empty then Push Operator Onto Stack. o If Present then Check Whether Priority of Incoming Operator is greater than Priority of Topmost Stack Operator. o If Priority of Incoming Operator is Greater than Push Incoming Operator Onto Stack. o Else Pop (Operator that have high Priority or equal) From Stack and push incoming operator to stack, again go to Step 1.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم
|