HOME BZU Mail Box Online Games Radio and TV Live Cricket Score All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Institute of Computing Bachelor of Science in Information Technology BsIT 3rd Semester Data Structure

Data Structure Lectures by Sir Ahsan..


Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 3 votes, 3.67 average. Display Modes
  #1  
Old 26-09-2008, 09:59 PM
.BZU.'s Avatar


 

Join Date: Sep 2007
Location: near Govt College of Science Multan Pakistan
Posts: 9,688
Contact Number: Removed
Program / Discipline: BSIT
Class Roll Number: 07-15
.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute
lectures Application of Stacks.. Infix post and prefix


Application of Stacks.. Infix post and prefix
September 22, 2008.

Data Structure

Expression:-collection of operators and operands is called expression.
i.e. in A+B A, B are operands and + is operator.
Types of Expression:
There are three types of Expression
  1. Infix
  2. Postfix
  3. Prefix
I) Infix:

In which operator is used between the operand
a+b
It is used in our common mathematical expressions.

II) Postfix:

In which operator is used after the operands.
i.e. ab+

III) Prefix:

In which the operator is used before the operands.
I .e. +ab

We use infix type in our daily life but the computer use the postfix or prefix, because it is easy for computer to calculate by using postfix or prefix.
Without the conversion of postfix and prefix is not possible
(Postfix ma jo show ho chukka ha usko prefix ma show krna ha to stack use krna para ga.)
Usually C++ programming used postfix but their use depends on the language creator, either he use postfix or prefix type.

Examples:
Consider the precedence of the operator, the precedence is decreasing downwardly.
( )
$ (this symbol is used for power symbol in the book of Tenun Baum and in shaum series the power symbol is denoted by a arrow with upward direction.)
/,* (both have same precedence)
+, _ (both have same precedence)

if there two operators with same precedence then computer start to solve the expression from left to right.
Examples of Postfix:
1)
a+b-c
ab+ - c
ab+c-


2)
a+b*c
a + bc* (we consider the bc* one term and a other term and + is operator between them and apply the postfix method.
aik color aik term o zahir krta ha.dusra color dusri term ko.in k dermean operators han.jesa k a+b-c men a, b, c alag alag tems han.ya colorz manta apko smjhana k ley dey han ta k apko alheda terms ka pata chal jay.sir na her term k nichy line lagwai thi ta k her term alheda ho jay and hamen asani sa smajh a jay.
)
abc* +
3)
(a+b)/ (e-f*c)
ab+ / (e-f*c) (idher a+b ma a, b alag alag terms thi.in k dermean + operator tha.operation k bad +ab ak term ban gai.Agy bhi yahi concept dea gaya ha.)
ab+ / ( e-fc*)
ab+ / efc*-
ab+ efc*-/

4)
(a+b)/ (e$f*c)
ab+ / (ef$ * c)
ab+ / ef$c*
ab+ef$c*/

5)
a+b/d*e$f+g
a+b/d*ef$ +g
a+ bd/ *ef$+g
a+ bd/ef$ *+g
abd/ef$* + + g
abd/ef$*+g+
6)
(a+b)/ (d*e$f+g)

This is exercise for you; its prefix solution will be given at the end.

Example of Prefix:

1)
a+b === +ab

2)
a+b-c
+ab - c
-+abc
3)
a+b/d*e$f+g
a+b/d* $ef + g
a+/bd* $ef + g
a + */bd$ef + g
+a*/bd$ef + g
++a*/bd$efg
4)
(a+b)/ (d*e$f+g)
+ab/(d*$ef + g)
+ab /( *d$f + g)
+ab/ +*d$fg
/+ab+*d$fg
Attached Files
File Type: doc Application of Stacks.. Infix post and prefix.doc (39.0 KB, 533 views)
__________________
(`v)
`*..*`

.*.*) .*)
(.* (.
Bzu Forum

Don't cry because it's over, smile because it happened
Reply With Quote
Reply

Tags
ahmad, application, infix, lectures, post, prefix, programming, stacks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stacks in Data Structures bonfire BsTS 2nd Semester 0 26-02-2011 11:50 PM
How to post attached image inside the Post (Inline attachment) .BZU. Suggestion,Feedback and News about site 5 25-09-2010 10:49 PM
program of single array acting as multiple stacks taha khan Data Structure 2 28-10-2008 09:06 PM
BIT3]Assignments:Transform infix to post fix ? .BZU. Data Structure 2 29-09-2008 01:40 AM
Algorithms to convert the infix to postfix .BZU. Data Structure 1 26-09-2008 10:01 PM

Best view in Firefox
Almuslimeen.info | Cloud Computing | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 05:57 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.