(½Ç½À10) ¹Ì·Îã±â
³»¿ë: ±³Àç chap5¿¡ ÀÖ´Â ¹Ì·Îã±â ÇÁ·Î±×·¥À» ±¸ÇöÇÏ¿© ½ÇÇàÇϽÿÀ.
1) ½ºÅÃÀÇ °ª°ú ¸¶¿ì½ºÀÇ ¿òÁ÷ÀÓÀ» ÅëÇØ ¹Ì·Îã±â ÇÁ·Î±×·¥ÀÇ µ¿ÀÛÀ» È®ÀÎÇϽÿÀ.
(printMaze() ÇÔ¼ö¿Í PrintStack() ÇÔ¼ö¸¦ »ç¿ëÇÏ¿© step º°·Î µ¿ÀÛÀ» È®ÀÎÇϽÿÀ.)
2) ±³Àç¿¡ ÀÖ´Â ¸¶¿ì½º´Â backtrackingÀ» Çѹøµµ ÇÏÁö¾Ê°í Ãⱸ¸¦ ã´Â´Ù.
¿Ö ±×·¯´ÂÁö ¼³¸íÇÏ°í, backtracking ÀÌ ÀϾ°Ô ÇÏ·Á¸é ÇÁ·Î±×·¥ÀÇ ¾îµð¸¦ ¼öÁ¤ÇؾßÇÏ´ÂÁö ¼³¸íÇϽÿÀ.
3) ¹Ì·Î¸¦ ¹Ù²Ù¾î ½Ç½ÀÇØ º¸½Ã¿À. ƯÈ÷ Ãⱸ°¡ ¾øÀ» °æ¿ì ÇÁ·Î±×·¥ÀÌ "½ÇÆÐ"¸¦ Ãâ·ÂÇÏ´ÂÁö È®ÀÎÇØ º¸½Ã¿À.
Ãß°¡1: Ãⱸ¸¦ ãÀº °æ¿ì ÀÔ±¸¿¡¼ Ãⱸ±îÁöÀÇ °æ·Î¸¦ (x,y) ÁÂÇ¥·Î Ãâ·ÂÇϵµ·Ï º¯°æÇϽÿÀ.
(´Ü, backtracking ÇÑ °æ·Î´Â Ãâ·ÂµÇ¸é ¾ÈµÊ)
[±³Àç ÇÁ·Î±×·¥ Âü°í]
- http://itsys.hansung.ac.kr/lec/dstruct/htmls/source/chap5/prog5-1.c
- http://itsys.hansung.ac.kr/lec/dstruct/htmls/source/chap5/prog5-2.c
- http://itsys.hansung.ac.kr/lec/dstruct/htmls/source/chap5/prog5-3.c
- http://itsys.hansung.ac.kr/lec/dstruct/htmls/source/chap5/prog5-4.c
- http://itsys.hansung.ac.kr/lec/dstruct/htmls/source/chap5/prog5-5.c
- http://itsys.hansung.ac.kr/lec/dstruct/htmls/source/chap5/prog5-6.c
- http://itsys.hansung.ac.kr/lec/dstruct/htmls/source/chap5/prog5-7.c
- http://itsys.hansung.ac.kr/lec/dstruct/htmls/source/chap5/prog5-8.c