hello friends, given an expression we have to remove the
unwanted brackets in that expression.
Eg : (a+b) ---> a+b
(a+b)*(c)-----> (a+b)*c. Please mail me if you know
the logic. My mail id is : saravana6m@gmail.com.
Thank you in advance :-)

Answer Posted / arjun

hello there,
the logic i quite simple and such questions are give just to
confuse us.

push the given string in a stack and while popping out
ignore the bracket PAIR which contain
i) a lone variable in between
ii) does not contain any operator before or after the bracket.

for eg. if (a+b)*c is there then bracket must not be ignored.

thanks

Is This Answer Correct ?    9 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I Draw an ellipse in 3d space and color it by using graph3d?

2228


Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?

7461


What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }

731


Write a (n) algorithm that sorts n distinct integers, ranging in size between 1 and kn inclusive, where k is a constant positive integer. (Hint: Use a kn-element array.)

4577


find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L

2128






Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

3489


i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

2095


how to diplay a external image of output on winxp by using c & c++,

3050


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

2151


How to swap two ASCII numbers?

2553


output for printf("printf");

2081


write a program to calculate the amount of investment after a period n years if the principal investors was p and interest is calculated using compound interest,formular=a=p(1+r)^n

2474


Code for Method of Handling Factorials of Any Size?

2088


Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?

3000


Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?

2656