- 2
- 0
- 约1.58万字
- 约 46页
- 2017-02-02 发布于江苏
- 举报
3.4.2 Terms Front——The end of a list that elements can only be deleted, denoted by front-pointer f. Rear——The end of a list that elements can only be added, denoted by rear-pointer r. Enqueue——To insert an element at the end of a queue. Dequeue——To delete the first element of a queue. 3.4.3 ADT ADT Queue { Data Objects: D={ ai | ai∈ ElemSet, i=1, 2, …, n, n ≥ 0 } Data Relationships: R1={ai-1, ai | ai-1, ai∈D, i=2, …, n} Assume that a1 is the front and an is the rear. Elementary Processes: InitQueue ( Q ) result: An empty queue Q constructed. DestroyQueue ( Q ) condition: Queue Q exists. result: Queue Q destroyed. ClearQueue ( Q ) condition: Queue Q exists. result: Queue Q reset to vacancy. QueueEmpty ( Q ) condition: Queue Q exists. result: Return true if queue Q is empty, or return false. QueueLength ( Q ) condition: Queue Q exists. result: Return the number of elements in queue Q. GetHead ( Q, e ) condition: Queue Q exists and is nonempty. result: Return the front of Q by e. EnQueue ( Q, e ) condition: Queue Q exists. result: Element e is inserted as the new rear of Q. DeQueue ( Q, e ) condition: Queue Q exists and is nonempty. result: The front of Q is deleted and returned by e. } ADT Queue 3.4.4 Representation and Implementation Like stacks, queues also have two storage forms: sequential and linked. Here we shall develop an implementation for queues based on array. The queue space is supplied by an array q[M] with the initialized condition f = r = -1. f and r will change when the operation of Dequeue or Enqueue occurs. Ex: given a queue q[3] 2 1 0 Empty queue f = r = -1 c b a Enqueue a,b,c f = 0, r = 2 Full queue 2 1 0 c b Dequeue a, f = 1, r = 2 Another Enqueue will lead to an illusive
您可能关注的文档
- CIF与FOB的取舍-案例综合课件精品.ppt
- ch5 招投标案例课件精品.ppt
- Chapter 2 Lesson 4课件精品.ppt
- CHAP 04 多样化实验教学 之 博弈游戏课件精品.ppt
- ch4-5-Security&Integrity课件精品.ppt
- chap6矿物的鉴定课件精品.ppt
- Chapter05 权益市场课件精品.ppt
- Chapter8 Other Transport课件精品.ppt
- chapter 3 翻译方法课件精品.ppt
- CI和VI的区别课件精品.ppt
- 2023年度十大热点人物的素材解读与运用-2024年高考语文作文热点素材积累运用与(全国通用).pdf
- 格力室外机中央空调价格表.pdf
- 2026上半年贵州事业单位联考贵州省交通运输厅招聘84人备考题库完整答案详解.docx
- 2026上半年贵州事业单位联考贵州传媒职业学院招聘12人备考题库附参考答案详解(达标题).docx
- 2026上半年贵州事业单位联考贵州省住房和城乡建设厅招聘16人备考题库含答案详解(培优).docx
- 2026上半年贵州事业单位联考玉屏侗族自治县招聘41人备考题库及答案详解(夺冠系列).docx
- 通信原理实验2数字频带传输系统实验.pdf
- 2026上半年贵州事业单位联考贵州医科大学第二附属医院招聘22人备考题库含答案详解(能力提升).docx
- 2026上海复旦大学计算力学与人工智能交叉研究院(筹)招聘专任研究员2人备考题库完整答案详解.docx
- 2026上半年贵州事业单位联考贵州民族大学招聘52人备考题库附参考答案详解(研优卷).docx
原创力文档

文档评论(0)