## Amdocs Interview Question for Software Engineer Interns

- -3of 3 votes

AnswerGiven N Vertices and M Edges. Each Edge connects two vertices.

- justhack4fun688 February 08, 2014 in United States

There is at most one way to move between each pair of vertices.

Each vertex is either locked or unlocked .There is a perfect path between two different vertices if both vertices are unlocked, and are connected with each other by some way.

The question is What is the number of pairs of vertices, which have a perfect path between them and also What is the number of the vertices, which have at least one perfect path passing through that vertex.

NOTE : There is at most one way to move between each pair of vertices, that is, the given graph is a forest

EXAMPLE : Say we have 6 Vertices and 5 Edges.

A=[1,1,1,1,1,0] It shows that A[i]=1 if ith vertex is unlocked otherwise 0.

Let the connected pair of vertices are : (1,2),(1,6),(1,5),(2,4),(4,3)

Here ,Answer for first question is 10 and second one is 5.

So,interviewer asked me to device an efficient algorithm for it and also code it in c++| Report Duplicate | Flag | PURGE

Amdocs Software Engineer Intern Algorithm

**Country:**United States

**Interview Type:**In-Person

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Be careful this user is a cheater he is posting questions from ongoing programming competition. Check this chefcode FEB14/problems/DRGHTS.

- Anonymous February 08, 2014Who are you trying to fool. If you are too stupid to solve problems yourself stop taking part in the competition.