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: put0
if vertex is not visited yet, or putk
if vertex is ink
th component. - Return tuple of lists of vertex numbers, one list for each component. Create it by using an upgraded
visited
list.
Завдання
Swipe to start coding
Implement getComponents()
function.
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 5
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Suggested prompts:
Сумаризуйте цей розділ
Пояснити код у file
Пояснити, чому file не вирішує завдання
Awesome!
Completion rate improved to 7.69
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: put0
if vertex is not visited yet, or putk
if vertex is ink
th component. - Return tuple of lists of vertex numbers, one list for each component. Create it by using an upgraded
visited
list.
Завдання
Swipe to start coding
Implement getComponents()
function.
Все було зрозуміло?
Дякуємо за ваш відгук!
Awesome!
Completion rate improved to 7.69Секція 2. Розділ 5
single