Urgent! easy stacks and queues problems

Q1. Write a program that outputs an appropriate message of grouping sybols, such as parentheses and braces, if an arithmetic expression matches. For example, the expression

{25 + ( 3 - 6 ) * 8 contains matching grouping symbols.

Q2. Write a program that uses a stack(not recursion) to convert a decimal number into an equivalent binary number.

Q3. Write a program that converts an infix expression into an equivalent postfix expression.

The rules are as follows:

Suppose **infx**represents the infx expression and **pfx**represents the postfix expression.

a. Initialize **pfx**to an empty expression and also initialize the stack.

b. Get the next symbol, **sym**, from **infx**.

b1. If **sym**is an operand, append **sym**to **pfx**.

b2. If **sym**is (, push **sym**, into the stack.

b3. If **sym**is ), pop and append all the symbols from the stack until the most recent left parentheses. Pop and discard the left parentheses.

b4. If sym is an operator:

b4.1. Pop and append all the operators from the stack to **pfx**that are above the most recent left parenteses and have precedence greater than or equal to sym.

b4.2. Push **sym**into the stack.

c. After processing **infx**, some operators might be left in the stack. Pop and append to **pfx**everything from the stack.

In this problem(Q3), you will consider the following (binary arithmetic operators: + - * and /. You may assume that the expressions you will process are error free.

1. **getInfix**: store the infx expression.

2. **showInfix**: Outputs the infx expression.

3. **showPostfix**: Outputs the postfix expression.

4. **convertToPostfix**: Converts the infix expression into a postfix expression. The resulting postfix expression is stored in **postfixString**.

## Deliverables

(Q3 cont)

[url removed, login to view] the precedence between two operators. If the first operator is of higher or equal precedence that the second operatorm it returns the value *true*; otherwise, it returns the value *false*.

Include the constructors and destructors for automatic initialization and dynamic nemory decallocation.

Test your program on these expressions:

1. A + B - C

2. (A + B ) * C;

3. (A + B) * C;

4. A + ((B + C) * ( E - F) - G) / (H - I);

5. A + B * ( C + D ) - E / F * G + H;

For each expression, youe answer must be in the following form:

Infix Expression: A + B - C;

Postfix Expression: AB+C-

My assignment is considing to be late already; therefore please do them as fast as possible may be in a couple of hours. I want these three problems are the way that my prof want. I said it’s easy for you coz I will attached my classmate's codes of all three questions for you once you are selected(Q2 is example below) and please make these problems simliar to my classmate's, exactly just following their ways and formats, so u don really have to write but just correct and change the codes. Remember, it’s important coz I am only beginner. This is really an urgent since these problems are extremely important to me and i don't have much time to work on them according to my skill. They can not be exactly as same as my classmate's code. Just make them look different but in the same format.

1. Please write(change) these problems in the way and format following my classmates’s code. e.g. use structs on all the problems, use #include <iostream> and #include<stdlib>. And the variable name must be different. Don’t write them too complex I am only a beginner of C++.

2. It should work on C++ emacs.

3. DO NOT USE CLASS. I am just not there yet of my lecture. I don want that my prof discovers that I cheat.

Please email me immedimately regarding to any problem. Below is the my classmate’s code of Q2 (also continue in the platform).

#include <iostream>

#include <stdlib.h>

#include <string>

struct nodetype{

int data;

nodetype *link;};

nodetype *top = NULL;

void push (int value) {

nodetype *newNode = new nodetype;

newNode->data = value;

newNode->link = top;

top = newNode;

return;}

bool isEmpty() {

if (top == NULL) return true;

return false;}

bool pop( int &val ){

nodetype *temp = top;

if (isEmpty()){

return false;

}

val = top->data;

top = top->link;

delete temp;

return true;

}

int main(){

int num, retval;

cout<<"Please Enter a Positive decimal integer that you want to convert to Binary:\n"<<endl;

cout<<"Decimal: ";

cin>>num;

if (num == 0) cout<<"Binary: 0\n";

else if (num == 1) cout<<"Binary: 1\n";

else if (num>1)

{

while ( (num/2) != 0 )

{

push(num%2);

num=(num/2);

}

push(1);

cout<<"Binary: ";

}

while( pop(retval) ){

cout<<retval<<" ";

}

cout<<endl;

}

## Platform

C++ only and should be work on emacs.

Acerca do Empregador:
( 13 comentários ) United States

ID do Projeto: #2979487

Concedido a:

bullsora

See private message.

\$25.5 USD em 1 dia
(24 Comentários)
4.0

4 freelancers estão ofertando em média \$29 para esse trabalho

mihaiscortaru

See private message.

\$33.66 USD em 1 dia
(158 Comentários)
6.0
vw821235vw

See private message.

\$23.8 USD em 1 dia
(93 Comentários)
4.3
lalesculiviu

See private message.

\$34 USD em 1 dia
(17 Comentários)
4.0