- 1
- 0
- 约1.27万字
- 约 53页
- 2018-02-06 发布于河南
- 举报
计算机科学概论(第9版)LectureSlide_08
Data Abstraction Basic Data Structures Chapter 8 Abstract Data Type Abstract Data Type as a design tool Concerns only on the important concept or model No concern on implementation details. Stack Queue is an example of ADT An array is not ADT. What is the difference? Stack Queue vs. Array Arrays are data storage structures while stacks and queues are specialized DS and used as programmer’s tools. Stack – a container that allows push and pop Queue - a container that allows enqueue and dequeue No concern on implementation details. In an array any item can be accessed, while in these data structures access is restricted. They are more abstract than arrays. Stack Stacks are Used for handling nested structures: processing directories within directories evaluating expressions within expressions handling branching processes traversing a branching tree structure planning a move in a chess game tracking the sequence of method calls in a Java program Stacks A stack is a data structure that only allows items to be inserted and removed at one end We call this end the top of the stack The other end is called the bottom Access to other items in the stack is not allowed A LIFO (Last In First Out) data structure Using a Stack What Are Stacks Used For? Most programming languages use a “call stack” to implement function calling When a method is called, its line number and other useful information are pushed (inserted) on the call stack When a method ends, it is popped (removed) from the call stack and execution restarts at the indicated line number in the method that is now at the top of the stack The Call Stack Call Stacks and Recursion A call stack is what makes recursion possible Stacks are also important when traversing tree data structures They enable us to “backtrack” through the tree We’ll see more about this later in the course Stack Operations A stack should implement (at least) these operations: push – insert an item at the top of the stack pop – remove and r
您可能关注的文档
最近下载
- 口腔市场专员培训.pptx VIP
- 如何制作西红柿炖牛腩,比饭店那酸酸的好吃太多啦!.pdf VIP
- 部编版二年级上册语文第11课《葡萄沟》教学课件.ppt VIP
- 部编版二年级上册语文《葡萄沟》PPT教学课件.pptx VIP
- 01 关于印发公司专业技术职务任职资格评定管理办法、专业技术职务任职资格考核认定(确认)办法和工程系列专业技术职务任职资格评审实施细则的通知(中电建人〔2019〕1号).pdf VIP
- 精品解析:福建省厦门市2022-2023学年九年级上学期期末(一检)化学试题(原卷版).docx VIP
- 2024-2025学年广东佛山市高二(上)期末数学试卷【答案版】.pdf VIP
- FANUC0i--急停故障维修方法.pptx VIP
- 全球定位系统实时动态测量RTK技术规范.docx VIP
- 部编版二年级上册语文《葡萄沟》教学课件.ppt VIP
原创力文档

文档评论(0)