
#include #include #include using namespace std; vector edge[10]; bool mark[10]; void bfs(int idx) { // {방문 정점, 깊이} queue q; // 정점 idx, 시작 정점이므로 깊이는 0부터 시작 q.push({idx, 0}); // 방문 기록 mark[idx] = true; while(!q.empty()) { // 기준 정점 int vertex = q.front().first; // 깊이 int depth = q.front().second; q.pop(); cout f >> t; edge[f].push_back(t); edge[t].push_back(f); } bfs(0); } input: 6 6. // 정점, 간선 갯수 ..
알고리즘
2021. 7. 19. 17:25
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Tree
- dfs
- 이분탐색
- 재귀
- recursion
- Brute Force
- binary search
- Kruskal
- graph
- CSS
- back tracking
- Dijkstra
- Stack
- db
- Unity
- BFS
- 자료구조
- Implementation
- Python
- priority queue
- greedy
- C
- DP
- 조합
- C++
- permutation
- two pointer
- MVC
- Spring
- floyd warshall
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함