Search : in
By :

Data Structure - Stack

Last answer on Jul 13, 2009 12:50:05 am BST don_226, on Mar 16, 2009 5:58:35 pm GMT 
 Report this message to moderators

Hello guys,
I am a biggener in D.S, i need someone to give me the code of the following question please.
I will be so thankfull and helpfull with him\her.
Regards,

Data Structure

Write a program that converts an arithmetic infix expression into a postfix expression. There is one stack for holding operators and the numbers or variables (in the arithmetic expression) will be transferred to a postfix string, after that appending the operators from the stack to the postfix string.



Example:
Input: String Infix = “a + 5 – c * d + c / 2”
Output: String Postfix = “a5cd*–+c2/+”

Note applies the following rules to convert the infix expression to postfix expression:
1. If the current char (in the Infix string) is number or mathematical variable, transfer it to Postfix string, and go to the next char.
2. If the char is operator, perform:
a. if the stack is empty push the operator into the stack, and go to the next char.
b. if the current operator (in the Infix string) have higher precedence than the top of the stack, push the operator into the stack, and go to the next char.
c. if the current operator (in the Infix string) have the same or less precedence than the top of the stack, pop the top of the stack and transfer it to Postfix string.
3. If the Infix string finish pop all contents of the stack and append it to the string Postfix.

Configuration: Windows XP
Internet Explorer 7.0

Best answers for « Data Structure Stack » in :
Java Runtime Machine Show Java Runtime Machine A Java Virtual Machine is a set of computer software and data structures that use a virtual machine model to execute other computer programs and scripts. JVM model use a form of computer intermediate language...
The logical structure of a hard disk ShowThe logical structure of a hard disk Introduction Logical Structure Sources Introduction When you use your computer, your data is organized in the form of files and directories, according to a tree structure and these are stored...
Backup Outlook 2003 data ShowBackup Outlook 2003 data All Outlook 2003 data ( Emails, Agenda, Contacts, Tasks...) are in one file with .pst extension The file is in the following default folder: C:\Documents and Settings\Login\Local Settings\Application...
Kernel stack inpage error. Beginning dump off physical memory ShowKernel stack inpage error. Beginning dump off physical memory ... By modifying the registry In the case that Windows displays a blue screen with the following error message: kernel_stack_inpage error And/ Or a message like...
Download Power Data Recovery ShowPower Data Recovery is a read-only data recovery software. It allows to recover data which have been deleted or formatted, attacked by a virus, and data which are lost after a system crash. Easy to use, it supports the following file systems: FAT...
OOP - Data encapsulation ShowThe concept of encapsulation Encapsulation is a way of organising data and methods into a structure by concealing the the way the object is implemented, i.e. preventing access to data by any means other than those specified. Encapsulation...
Data transmission - Cabling ShowCabling types Several physical data-transmission media are available to connect together the various devices on a network. One possibility is to use cables. There are many types of cables, but the most common are: Coaxial cable Double twisted...
Structure of an email (Headers and bodies) ShowStructure of an email An email has three basic parts: The header, a set of lines containing information about the message's transportation, such as the sender's address, the recipient's address, or timestamps showing when the message was sent by...

1

msnnopes, on Mar 17, 2009 11:17:24 am GMT

Hi,
try this link, you can download a software to convert an arithmetic infix expression into a postfix expression:
http://webscripts.softpedia.com/script/Snippets/infix-to-pos­tfix-27387.html
try this link to get help using stacks:
www.cs.sjsu.edu/~kim/46b/contents/handouts/calculator.doc

Reply to msnnopes

2

don_226, on Mar 21, 2009 7:16:25 pm GMT
  • +2

Thank you my dear.

Reply to don_226

3

www.cprogramming.coz.bz, on Jul 13, 2009 12:46:57 am BST
  • +1

Visit www.cprogramming.coz.bz/stack.html

Reply to www.cprogramming.coz.bz

4

 www.cprogramming.coz.bz, on Jul 13, 2009 12:50:05 am BST
Reply to www.cprogramming.coz.bz