출처 : KOCW 부경대학교 권오흠 교수 알고리즘 강의
목차
- 미로찾기 재귀적 사고
- Psudocode
핵심
- 연습! 연습!
미로찾기 재귀적 사고
현재 위치에서 출구까지 가는 경로가 있으려면
- 현재 좌표가 출구거나
- 이웃한 셀들 중 하나에서 현재 위치를 지나지 않고 출구로 가는 방법이 있거나.
Psudocode
boolean findPath(x, y) {
if (x,y) is either on the wall or a visited cell
return false;
else if (x,y) is the exit
return true;
else
mark (x,y) as a visited cell;
for each neighbouring cell (x', y') of (x,y) do
if findPath(x', y')
return true;
return false;
}
code
'프로그래밍 > Algorithm & Structure' 카테고리의 다른 글
20.01.06) DataStructure - LinkedList(ongoing) (0) | 2020.01.06 |
---|---|
19.12.25) Algorithm - Recursive Blob (0) | 2019.12.25 |
19.12.25) Algorithm - Design recursion (0) | 2019.12.25 |
19.12.24) Algorithm - recursive thinking (0) | 2019.12.25 |
19.12.23) Algorithm - recursion (0) | 2019.12.24 |