Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Find All Connected Components | Practice
Breadth First Search

Deslize para mostrar o menu

book
Find All Connected Components

BFS find all connected components

Complicate the problem: find all components in a graph.

Some hints for you:

  • When you’re done with the first component, save it, and start traversing again with some nodes that haven’t been visited yet.

  • To split your components, you can use an upgraded visited list: put 0 if vertex is not visited yet, or put k if vertex is in kth component.

  • Return tuple of lists of vertex numbers, one list for each component. Create it by using an upgraded visited list.

Tarefa

Swipe to start coding

Implement getComponents() function.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 5
Sentimos muito que algo saiu errado. O que aconteceu?

Pergunte à IA

expand
ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

book
Find All Connected Components

BFS find all connected components

Complicate the problem: find all components in a graph.

Some hints for you:

  • When you’re done with the first component, save it, and start traversing again with some nodes that haven’t been visited yet.

  • To split your components, you can use an upgraded visited list: put 0 if vertex is not visited yet, or put k if vertex is in kth component.

  • Return tuple of lists of vertex numbers, one list for each component. Create it by using an upgraded visited list.

Tarefa

Swipe to start coding

Implement getComponents() function.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 5
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Sentimos muito que algo saiu errado. O que aconteceu?
some-alt