## Interview Question

**Country:**India

**Interview Type:**In-Person

Algo:

Step 1: choose one node as "acceptor" node.

Step 2: all of the other nodes send their values to acceptor node. Acceptor node 'adds' them to its value. So this has 'n - 1' operations. And now the value of acceptor node is 10.

Step 3: acceptor node sends its value to all the other nodes and the other nodes 'overwrite' the value, so all the other nodes too get the value 10. This also has 'n-1' operations.

Total number of operations '2n - 2'.

Algo:

Step 1: choose one node as "acceptor" node.

Step 2: all of the other nodes send their values to acceptor node. Acceptor node 'adds' them to its value. So this has 'n - 1' operations. And now the value of acceptor node is 10.

Step 3: acceptor node sends its value to all the other nodes and the other nodes 'overwrite' the value, so all the other nodes too get the value 10. This also has 'n-1' operations.

Total number of operations '2n - 2'.

I hadn't logged in when I posted the result :(. Check the time difference between this post and original post its very close , which kindof proves that I made the earlier post as well.

I didnt get the question -

- jassi.srmcem May 02, 2014There will be condition in which a node can either add, reject or override the value. What is that?

How will a node determine when to add, when to override and when to add to its own value?