📄 英汉对照典型数据结构—栈和队列.htm
字号:
<DIV id=cont_right style="WIDTH: 495px">The data types arrays and records
are native to many programming languages.By using the pointer data type
and dynamic memory allocation,many programming languages also provide the
facilities for constructing linked structures.Arrays,records,and linked
structures provide the building blocks for implementing what we might call
higher-level abstractions.The first two higher-level abstract data types
that we take up-stacks and queues-are extremely important to
computing.<BR><BR>A stack is a data type whose major attributes are
determined by the rules governing the insertion and deletion of its
elements.The only element that can be deleted or removed is the one that
was inserted most recently.Such a structure is said to have a“last
in,first out”(LIFO)behavior,or protocol.The simplicity of the data type
stack belies [1] its importance.Many computer systems have stacks built
[2] into their circuitry and have machine-level instructions to operate
the hardware stack.The sequencing of calls to and returns from subroutines
follows a stack protocol.Arithmetic expressions are often evaluated by a
sequence of operations on a stack.Many handheld calculators use a stack
mode of operation.In studying computer science,you can expect to see many
examples of stacks.<BR><BR>Queues occur frequently in everyday life and
are therefore familiar to us.<BR><BR>The line of people waiting for [3]
service at a bank or for tickets at a movie theater and the line of autos
at a traffic light are examples of queues.The main feature of queues is
that they follow a“first come,first served”rule.Contrary to a stack,in
which the latest element inserted is the first removed or served,in queues
the earliest element inserted is the first served.In social settings,the
rule appeals to our sense of equality and fairness.<BR><BR>There are many
applications of the FIFO protocol of queues in computing.For example,the
line of input/output(I/O)requests waiting for access to a disk drive in a
multiuser time-sharing system might be a queue.The line of computing jobs
waiting to be run on a computer system might also be a queue.The jobs and
I/O requests are serviced in order of their arrival,that is,the first in
is the first out.<BR><BR>There is a second kind of queue that is
important.An everyday example can be seen in an emergency room of a
hospital.In large emergencies it is common to first treat the worst
injured patients who are likely to survive.In certain societies in which
1ess emphasis is placed on equality,people with higher social standing may
be treated first.<BR><BR>In computer systems,events that demand the
attention of the computer are often handled according to
a“most-important-event served-first”,or“highest-priority
in/first-out”(HPIFO),rule.Such queues are called priority queues,in this
type of queue service is not in order of time of arrival but rather in
order of some measure of
priority.<BR><BR>数组和记录在很多程序设计语言中都作为固有数据类型。通过使用指针数据类型和动态存储分配,很多程序设计语言也提供构造链接结构的设施。数组、记录和链接结构提供了实现所谓更高一级抽象的基本构件。本文将要讨论的两种更高一级抽象数据类型,栈和队列,对计算至关重要。<BR><BR>栈是这样一种数据类型,其主要属性是由支配其元素的插入与删除的规则来决定的,被删除或移去的元素只能是最后插入的,即所谓具有后进先出(LIFO)性质或规范。<BR><BR>数据类型栈的简单性使人对其重要性产生误解。许多计算机系统把栈做成其电路,并有操作这种硬件栈的机器指令。子例程的调用和返回序列都服从栈协议。算术表达式的求值都是通过对栈的操作序列来实现的。很多手持计算器都是用栈方式来操作的。在学习计算机科学时,将能看到许多栈的例子。<BR><BR>队列在日常生活中经常出现并且为我们所熟悉。在银行等待服务或在电影院门口等待买票的一队人,在红灯前等待通行的一长串汽车,都是队列的例子。队列的主要特征是遵循先来先服务(First
Come,first
served)的原则。与栈后进先出的特征不同,在队列中,最先插入的元素将最先除去或接受服务,这样的原则与社会生活中人们公正与平等的意识是一致的。<BR><BR>队列的先进先出(FIFO)原则在计算机中有很多应用。例如,在多用户分时操作系统中,等待访问磁盘驱动器的多个输入输出(I/O)请求就可能是一个队列。等待在计算机中运行的作业也形成一个队列,计算机将按照作业和I/O请求到达的先后次序进行服务,也就是按先进先出的次序服务。<BR><BR>另外,还存在着一种重要的队列:在医院的急救室内每天都可以看到的例子。在危重病人多的情况下,医生必须首先抢救生命垂危的病人。在某些不太强调平等性的社会中社会地位高的人可以最先得到治疗。<BR><BR>在计算机系统中,要求计算机系统服务的事件通常是最重要的事件最先服务,换句话说,按最高优先级先进先出队列(HPIFO)的原则。这种队列称之为优先级队列。优先级队列并不按进入队列的时间的先后决定服务的次序,而是按照优先级确定的次序。<BR><BR></DIV></TD></TR></TBODY></TABLE>
<FORM style="MARGIN: 0px" name=TheForm
onsubmit=javascript:document.all.Submit1.disabled=true; action=view.asp
method=post>
<TABLE cellSpacing=1 cellPadding=5 width="100%" align=center bgColor=#6595d6
border=0>
<TBODY>
<TR bgColor=#fff5ec>
<TD vAlign=top align=middle bgColor=#fff5ec colSpan=2 height=3>
<DIV align=left><FONT
color=#ff0000>本帖内容仅代表网友观点,与希赛网立场无关。如发现帖子内容有与法律抵触之处,请向<A class=chinablue
href="mailto:master@csai.cn">网站管理员</A>举报。</FONT></FONT></DIV></TD></TR>
<TR>
<TD class=chinabai vAlign=top align=middle bgColor=#6595d6 colSpan=2
height=3><IMG height=16 src="英汉对照典型数据结构—栈和队列_files/shownew.gif" width=16
align=absMiddle><FONT
color=#ffffff>注意:本社区里的任何言论仅代表发言者个人的观点,与希赛网立场无关。请对您的言论负责,遵守中华人民共和国有关法律、法规。如果您的帖子违反<A
class=chinahong href="http://bbs.csai.cn/bbs/help/index.asp"
target=_blank><STRONG>希赛网社区规则</STRONG></A>,将立即删除;如果再次发布,则封IP。</FONT></TD></TR>
<TR>
<TD vAlign=top bgColor=#fefefe height=22><A name=Answer></A><IFRAME
src="英汉对照典型数据结构—栈和队列_files/inc_search.htm" frameBorder=0 width="100%"
height=22></IFRAME><FONT color=red>Firefox浏览器用户请使用编辑器的[粘贴]按钮进行粘贴</FONT>
<INPUT type=hidden value={9A7C3902-9717-41DF-86A9-C8839A5B63F7}
name=backtitle>
<DIV><INPUT id=PContent style="DISPLAY: none" type=hidden
name=PContent><INPUT id=PContent___Config style="DISPLAY: none"
type=hidden value=SkinPath=/fckeditor23/editor/skins/silver/><IFRAME
id=PContent___Frame src="英汉对照典型数据结构—栈和队列_files/upload.htm" frameBorder=0
width="100%" scrolling=no height=260></IFRAME></DIV><INPUT type=hidden
value=1 name=backpage></TD></TR>
<TR>
<TD class=hai vAlign=top align=middle bgColor=#efefef height=22><INPUT
type=hidden value=post name=action> <INPUT type=submit value=提交回复 name=Submit1>(按撤消键或CTRL+Z进行撤消)</TD></TR></TBODY></TABLE></FORM><FONT
color=#666666>125.00000ms</FONT> </DIV>
<DIV id=body_right
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: right; OVERFLOW-X: hidden; PADDING-BOTTOM: 0px; MARGIN: 0px; WIDTH: 176px; PADDING-TOP: 0px">
<DIV style="BACKGROUND-COLOR: #f7f7f7"><A class=chinablue
href="javascript:closead();"><IMG height=30
src="英汉对照典型数据结构—栈和队列_files/closead_bt.gif" width=176 border=0></A></DIV>
<TABLE borderColor=#6595d6 height="100%" cellSpacing=0 borderColorDark=#ffffff
cellPadding=0 width=177 bgColor=#ffffff border=1>
<TBODY>
<TR>
<TD vAlign=top>
<SCRIPT type=text/javascript>
var arrBaiduCproConfig=new Array();
arrBaiduCproConfig['uid'] =341368;
arrBaiduCproConfig['n'] ='csai_cpr';
arrBaiduCproConfig['tm'] =18;
arrBaiduCproConfig['cm'] =196;
arrBaiduCproConfig['um'] =22;
arrBaiduCproConfig['w'] =173;
arrBaiduCproConfig['h'] =600;
arrBaiduCproConfig['wn'] =1;
arrBaiduCproConfig['hn'] =4;
arrBaiduCproConfig['ta'] ='left';
arrBaiduCproConfig['tl'] ='top';
arrBaiduCproConfig['bu'] =1;
arrBaiduCproConfig['bd'] ='#DD6400';
arrBaiduCproConfig['bg'] ='#FEF0E2';
arrBaiduCproConfig['tt'] ='#0000ff';
arrBaiduCproConfig['ct'] ='#333333';
arrBaiduCproConfig['url'] ='#666666';
arrBaiduCproConfig['bdl'] ='#ffffff';
arrBaiduCproConfig['rad'] =1;
</SCRIPT>
<SCRIPT src="英汉对照典型数据结构—栈和队列_files/ui.js" type=text/javascript></SCRIPT>
<SCRIPT type=text/javascript>
<!--
document.write(baiduCproIFrame());
-->
</SCRIPT>
<DIV style="MARGIN: 0px; OVERFLOW: hidden; WIDTH: 173px">
<SCRIPT src="英汉对照典型数据结构—栈和队列_files/rightlist.htm"
type=text/javascript></SCRIPT>
</DIV></TD></TR></TBODY></TABLE></DIV></DIV>
<SCRIPT>
function closead(){
var d_left=document.getElementById("body_left");
//var t_left=document.getElementById("body_leftTab");
var d_right=document.getElementById("body_right");
var arrDiv=document.getElementsByTagName("div");
for (var i=0;i<arrDiv.length;i++){
if(arrDiv[i].id=="cont_right") arrDiv[i].style.width='668px';
}
d_left.style.width='777px';
//t_left.style.width='777px';
d_right.style.display='none';
}
</SCRIPT>
<SCRIPT src="英汉对照典型数据结构—栈和队列_files/api.js"></SCRIPT>
<DIV style="FLOAT: left" align=center><BR>
<SCRIPT language=javascript src="英汉对照典型数据结构—栈和队列_files/showAds.htm"></SCRIPT>
<SCRIPT language=javascript src="英汉对照典型数据结构—栈和队列_files/right.htm"></SCRIPT>
</DIV></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -