[C++] 백준 2606(인접 리스트, DFS)


[C++] 백준 2606(인접 리스트, DFS)

문제 소스 코드 #include <iostream> using namespace std; typedef struct adjlists { int data; adjlists* LINK; }; int ans = 0; int visited[101] = {0}; adjlists* adj; adjlists* find_last(adjlists* adj) { while(adj->LINK != NULL) { adj = adj->LINK; } return adj; } void LINK_LIST(adjlists* adj, int num1, int num2) { adjlists* tmp1 = new adjlists; tmp1->LINK = NULL; tmp1->data = num1; adjlists* tmp2 = new adjlists; tmp2->LINK = NULL; tmp2->data = num2; find_last(&adj[num1])->LINK = tmp2; find_last(&adj[num2]...



원문링크 : [C++] 백준 2606(인접 리스트, DFS)