Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ DFS, BFS ] 10월 9일 #7

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

[ DFS, BFS ] 10월 9일 #7

wants to merge 10 commits into from

Conversation

sari-harin
Copy link
Collaborator

@sari-harin sari-harin commented Oct 9, 2023

인적사항

학번: 2071079
이름: 이하린

과제제출

기존 제출: 1325, 4963
추가 제출: 2615

Copy link
Member

@Goldchae Goldchae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[BFS&DFS 알고리즘 코드 리뷰 완료]
p3. 전체적으로 깔끔하고 좋은 코드로 작성해주셨네요! 코멘트 남긴 부분 확인해주세요! 수고하셨습니다!

}
}

return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다음번에는 주석 작성 부탁드립니다!

Comment on lines +7 to +17
void dfs(int c, vector<bool>& visited, vector<vector<int>>& com, int& cnt){
visited[c]=true;

for(int i=0;i<com[c].size();i++){
int temp=com[c][i];
if(!visited[temp]){
cnt++;
dfs(temp, visited, com, cnt);
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

참조로 넘겨 주신 점, 깔끔한 기본 DFS 함수 좋습니다!

}
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 문제는 BFS로는 쓸 수 없을까요? 가능하다면 한번 작성해보세요! DFS 함수도 스택을 이용해서 구현해보셔도 도움이 많이 될 것 같습니다!

}
}
}
cout << count << '\n';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endl을 사용하시는 편이 시간복잡도에 좋습니다!

Comment on lines +7 to +9
vector<int> dir_x={-1, 1, -1, 1, 0, 0, -1, 1};
vector<int> dir_y={-1, 1, 1, -1, 1, -1, 0, 0};
int board[50][50];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋습니다!

return (x>=0 && x<h && y>=0 && y<w);
}

void dfs(int x, int y, int w, int h){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 문제도 BFS로는 쓸 수 없을까요? 가능하다면 한번 작성해보세요!

}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깔끔하고 좋습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants