Pergunta da entrevista

Entrevista para Senior Software Engineer

-Belo Horizonte, Minas Gerais, Minas Gerais

Google

Given a file that represent a graph, write an algorithm that compute the number of triangles in the graph.

Resposta

Respostas da entrevista

3 respostas

1

What about running a DFS on every node looking for an egde that connects to the original vertex in the third depth? Running time would be O (n2 + nm) )

Confidencial em

0

I didn't finished this one.

Confidencial em

0

What about running BFS and check how many edges connect nodes on the same level.

SmartAss em

Adicionar respostas ou comentários

Para comentar sobre isso, entre na conta ou cadastre-se.