⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 用栈实现迷宫问题求解_数据结构与算法_数据结构算法_c语言_c 语言之家.htm

📁 严蔚民版的数据结构的完整课件
💻 HTM
📖 第 1 页 / 共 5 页
字号:
                              struct{<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>int ord;<SPAN 
                              style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当前位置在路径上的序号</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>PostType seat;//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当前坐标</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>int di;<SPAN 
                              style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">往下一坐标的方向</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">}SElemType;<SPAN 
                              style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">栈元素类型</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">typedef 
                              struct{<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>SElemType* base;//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">栈基址</SPAN><SPAN 
                              lang=EN-US style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">,</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">构造前销毁后为空</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>SElemType* top;//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">栈顶</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>int stackSize;<SPAN 
                              style="mso-spacerun: yes">&nbsp; 
                              </SPAN>//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">栈容量</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">}Stack;<SPAN 
                              style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">栈类型</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">Status InitStack(Stack 
                              &amp;S){<SPAN style="mso-tab-count: 1">&nbsp; 
                              </SPAN>//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">构造空栈</SPAN><SPAN 
                              lang=EN-US style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">s<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>S.base=(SElemType*)malloc(INIT_SIZE 
                              *sizeof(SElemType));<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>if(!S.base)<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>exit(OVERFLOW);//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">存储分配失败</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>S.top=S.base;<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>S.stackSize=INIT_SIZE;<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>return OK;<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">}//InitStack<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">Status StackEmpty(Stack 
                              S){<SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN><o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">若</SPAN><SPAN 
                              lang=EN-US style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">s</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为空返回</SPAN><SPAN 
                              lang=EN-US style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">TRUE,</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">否则返回</SPAN><SPAN 
                              lang=EN-US style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">FALSE<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>if(S.top==S.base)<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>return TRUE;<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>return FALSE;<o:p></o:p></FONT></SPAN></P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -