Interview Question


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
0
of 0 vote

I didnt get the question -
There 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?

- jassi.srmcem May 02, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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'.

- Anonymous May 03, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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.

- gauravkadyan May 03, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

consider parallelism

- Anonymous May 18, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I mean to say if there are n nodes you can find n/2 pair and sum it up. Then you can find n/4 pairs and sum it up. Finally you will have the sum then distribute it again. Hope that helps.

- B K May 18, 2014 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More