in CO and Architecture
1,957 views
1 vote
1 vote

Consider the evaluation of following expression tree on a machine in which memory can be accessed only through load and store instructions. The variable p, q, r, s, t and u are initially  stored in memory. The binary operators used in the tree can be evaluated by the machine only when all operands are in register. The instruction produce result only in a register.

What is the minimum number of registers needed to evaluate the expression if, no intermediate results can be stored in memory?

in CO and Architecture
by
2.0k views

2 Comments

its 3
1
1
I think 4

how 3??
0
0

1 Answer

4 votes
4 votes

I think 3 registers required only

4 Comments

yes it can be done with 3 registers!
0
0
can the problem be done using sethi ullman algorithm??
0
0

@Bikram 

@Prateek Raghuvanshi

I think evolution of expression tree is from left to right ,top to bottom but here you have changed the order order of evolution and this is only possible in case of parallel processing of all the node .

 

so what i want to ask is that  evolution of expression tree is from left to right ,top to bottom ,is this assumption right ??

if order of evolution is fixed then ans is 4 otherwise answer is 3

0
0

Related questions

0 votes
0 votes
0 answers
3