The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+3 votes
2.2k views

Choose the equivalent prefix form of the following expression

(a+(b-c))*((d-e)/(f+g-h))

 

  1. *+a-bc/-de-+fgh
  2. *+a-bc-/de-+fgh
  3. *+a-bc/-ed-+fgh
  4. *+ab-c/-de-+fgh
asked in DS by Veteran (36.2k points) | 2.2k views

6 Answers

+6 votes
Best answer
( a + ( b - c ) ) * ( ( d - e ) / ( f + g - h ) )

( a + ( b - c ) ) * ( ( - de) / ( ( + f g) - h ) )

( a + ( - bc ) ) * ( ( - de ) / ( - + f g h ) )

( + a - b c)  *  ( / - d e - + f g h)

* + a - b c / - d e - + f g h

Option A will be correct...
answered by Veteran (25.9k points)
selected by
+3 votes

(A) option answer .

answered by Veteran (22.1k points)
+2 votes

To find the equivalent prefix form (or Polish Notation):

1) The given expression is in infix form i.e. fully parenthesized unambigous expression

2) Firstly,we have to make a rooted binary tree for the given expression

3) Then we have to apply Preorder Tree Traversals

4) The obtained expression would be an equivalent prefix or polish notation

On solving we can check that A is the correct answer...

answered by Active (1.5k points)
+1 vote
Answer is A
answered by Junior (749 points)
0 votes
Option A
answered by (413 points)
0 votes
Ans: A
answered by Boss (7.8k points)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

33,712 questions
40,256 answers
114,368 comments
38,885 users