Seize your moment! ๐Ÿ‘พ

์•ˆ๋…•ํ•˜์„ธ์š”. Eric์ž…๋‹ˆ๋‹ค. ์ œ ๋ธ”๋กœ๊ทธ์— ๋ฐฉ๋ฌธํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ’ป ๊ฐœ๋ฐœ๊ณต๋ถ€/Algorithm

[Eric's ๋ฐฑ์ค€] 1260๋ฒˆ - DFS ์™€ BFS - Java

Eric_ko 2023. 2. 3. 01:32

์•ˆ๋…•ํ•˜์„ธ์š”! Eric ์ž…๋‹ˆ๋‹ค

์˜ค๋Š˜์€ ๊ทธ๋ž˜ํ”„ ์ˆœํšŒ ๋ฌธ์ œ๋ฅผ ํ’€์–ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

dfs ๋ž‘ bfs ๋ฅผ

์ฃผ์–ด์ง„ ์˜ˆ์‹œ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ 

์ €๋Š” ์ง์ ‘ ๊ทธ๋ ค์„œ ๋ฌธ์ œ๋ฅผ ํ’€์–ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

ํ•˜๋‹จ์˜ ๋‘ ์‚ฌ์ง„ ์ค‘ ๊ฐ๊ฐ์ขŒ์ธก ๋ถ€๋ถ„์˜ ๊ทธ๋ฆผ์ด dfs ๋ฐฉ์‹์ด๋ฉฐ,

ํ•˜๋‹จ์˜ ๋‘ ์‚ฌ์ง„ ์ค‘ ๊ฐ๊ฐ ์šฐ์ธก ๋ถ€๋ถ„์ด Queue๋ฅผ ์ด์šฉํ•œ bfs ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.

 

 

 

์ฝ”๋“œ๊ตฌํ˜„

์ฝ”๋“œ๋ฅผ ๊ตฌํ˜„ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.

Solved.ac ํ”„๋กœํ•„