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

📄 ds3.2习题.htm

📁 这是清华大学所用的数据结构的电子版教材
💻 HTM
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>数 据 结 构</title>
<meta name="Microsoft Theme" content="hounk 010">
</head>

<body background bgcolor="#000099" text="#CCCC99" link="#FF9900" vlink="#996600" alink="#FF3300">

<!--mstheme--><font face="宋体">

<p:colorscheme
 colors="#0000FF,#FFFFFF,#000000,#FFCC66,#00FFFF,#3366FF,#FF0033,#FFFF00"/>
<p align="center"><b><font face="oúì?,SimHei" lang="ZH-CN" color="#FFFFFF" size="6">第三章习题</font></b></p>
<p class="MsoNormal"><span lang="EN-US"><b><font size="5" color="#FFFFFF">2.</font></b></span><b><font size="5" color="#FFFFFF"><span style="font-family:宋体;mso-ascii-font-family:&quot;Times New Roman&quot;;mso-hansi-font-family: 
&quot;Times New Roman&quot;">设以数组</span><span lang="EN-US">se[m]</span><span style="font-family:宋体;mso-ascii-font-family:&quot;Times New Roman&quot;;mso-hansi-font-family: 
&quot;Times New Roman&quot;">存放循环队列的元素,同时设变量</span><span lang="EN-US">rear    
</span><span style="font-family:宋体;mso-ascii-font-family:&quot;Times New Roman&quot;;mso-hansi-font-family: 
&quot;Times New Roman&quot;">和</span><span lang="EN-US">front</span><span style="font-family: 
宋体;mso-ascii-font-family:&quot;Times New Roman&quot;;mso-hansi-font-family:&quot;Times New Roman&quot;">分别作为队头队尾指针,且队头指针指向队头前一个位置,写出这样设计的循环队列入队出队的算法</span><span style="font-family: 宋体; mso-ascii-font-family: Times New Roman; mso-hansi-font-family: Times New Roman">。</span></font></b></p>
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0"><b><font size="5" color="#FFFFFF"><span style="font-family:宋体;mso-ascii-font-family:&quot;Times New Roman&quot;; 
mso-hansi-font-family:&quot;Times New Roman&quot;">解答:</span></font></b></p> 
 
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0"> </p> 
 
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0"><b><font size="5" color="#FFFFFF"><span style="font-family: 宋体; mso-ascii-font-family: Times New Roman; mso-hansi-font-family: Times New Roman">int  
Outseq(</span></font></b><font size="5" color="#FFFFFF"><b>SeQueue *sq</b></font><b><font size="5" color="#FFFFFF">,elemtype 
x<span style="font-family: 宋体; mso-ascii-font-family: Times New Roman; mso-hansi-font-family: Times New Roman">)</span></font></b></p> 
 
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0"><b><font size="5" color="#FFFFFF"><span style="font-family: 宋体; mso-ascii-font-family: Times New Roman; mso-hansi-font-family: Times New Roman">{</span></font></b></p> 
 
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0">&nbsp;  
<font size="5" color="#FFFFFF"><b>if(sq.rear==sq.front) return 0;</b></font></p>  
 
<p ALIGN="JUSTIFY" style="margin-top: 0; margin-bottom: 0"><font size="5" color="#FFFFFF"><b>&nbsp;sq.front++;</b></font></p>
<p ALIGN="JUSTIFY" style="margin-top: 0; margin-bottom: 0"><font size="5" color="#FFFFFF"><b>&nbsp;x=sq.data[sq.front];</b></font></p>
<p ALIGN="JUSTIFY" style="margin-top: 0; margin-bottom: 0"><font size="5" color="#FFFFFF"><b>&nbsp;return  
1;&nbsp;</b></font></p>
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0"><b><font size="5" color="#FFFFFF"><span style="font-family: 宋体; mso-ascii-font-family: Times New Roman; mso-hansi-font-family: Times New Roman">}</span></font></b></p> 
 
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0"> </p> 
 
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0"><b><font size="5" color="#FFFFFF"><span style="font-family: 宋体; mso-ascii-font-family: Times New Roman; mso-hansi-font-family: Times New Roman">int  
Inseq(</span></font></b><font size="5" color="#FFFFFF"><b> SeQueue *sq</b></font><b><font size="5" color="#FFFFFF">,elemtype 
x<span style="font-family: 宋体; mso-ascii-font-family: Times New Roman; mso-hansi-font-family: Times New Roman">)</span></font></b></p> 
 
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0"><b><font size="5" color="#FFFFFF"><span style="font-family: 宋体; mso-ascii-font-family: Times New Roman; mso-hansi-font-family: Times New Roman">{</span></font></b></p> 
 
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0">&nbsp;  
<font size="5" color="#FFFFFF"><b>if(sq.rear==sq.front) return 0;&nbsp;</b></font></p>  
 
<p ALIGN="JUSTIFY" style="margin-top: 0; margin-bottom: 0"><font size="5" color="#FFFFFF"><b>&nbsp;sq.rear++;</b></font></p>
<p ALIGN="JUSTIFY" style="margin-top: 0; margin-bottom: 0"><font size="5" color="#FFFFFF"><b>&nbsp;sq.data[sq.rear]=x;</b></font></p>
<p ALIGN="JUSTIFY" style="margin-top: 0; margin-bottom: 0"><font size="5" color="#FFFFFF"><b>&nbsp;return  
1;&nbsp;</b></font></p>
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0"><b><font size="5" color="#FFFFFF"><span style="font-family: 宋体; mso-ascii-font-family: Times New Roman; mso-hansi-font-family: Times New Roman">}</span></font></b></p> 
 
<p ALIGN="JUSTIFY" style="margin-top: 0; margin-bottom: 0"> </p>
<p ALIGN="JUSTIFY" style="margin-top: 0; margin-bottom: 0"><font size="5" color="#FFFFFF"><b>&nbsp;</b></font></p>
<p class="MsoNormal" align="center"><b><a href="ds3习题.HTM"><font size="5" color="#FFFF00">返回</font></a></b></p> 
 
<!--mstheme--></font> 
 
</body> 
 
</html> 

⌨️ 快捷键说明

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