TCS
Company
what to do for:
1.cyclic handshake
2.acyclic handshake
3.when to apply n(n-1)/2
Read Solution (Total 3)
-
- 1. for cyclic >> no. of handshakes is = no. of peoples.
2. for acyclic>> no. of handshakes is = no. of peoples - 1.
3. when everyone is shaking hands with everyone else apply n(n-1)/2. - 14 years agoHelpfull: Yes(19) No(0)
- Suppose there are n people namely A1, A2, ... AN
1. Cyclic Handshake
A1 shaking hands with A2
A2 shaking hands with A3
A3 shaking hands with A4
...
An-1 shaking hands with An
An shaking hands with A1
Here, each person shakes hands with only two people
2. Acyclic Handshake
Here, A1 shakes hand with each of the (n-1) people around
3.
So, total handshakes = n*(n-1)/2
the division by 2 is becuase each handshake would be counted twice when we move as per the above method (acyclic handshake)
- 13 years agoHelpfull: Yes(2) No(0)
- 1.cyclic=n-1
- 14 years agoHelpfull: Yes(0) No(3)
TCS Other Question