20162314 《Program Design & Data Structures》Learning Summary Of The Fifth Week
20162314 2017-2018-1 《Program Design & Data Structures》Learning Summary Of The Fifth Week
Summary of Key Concepts
A collection is an object that gathers and organizes other objects.
Elements in a collection are typically organized by the order of their addition to the collection or by some inherent relationship among the elements.
A collection is an abstraction where the details of the implementation are hidden.
A data structure is the underlying programming constructs used to implement a collection.
Stack elements are processed in a LIFO manner—the last element in is the first element out.
A programmer should choose the structure that is appropriate for the type of data management needed.
A polymorphic reference uses the type of the object, not the type of the reference, to determine which version of a method to invoke.
A Java interface defines a set of abstract methods and is useful in separating the concept of an abstract data type from its implementation.
By using the interface name as a return type, the interface doesn’t commit the method to the use of any particular class that implements a stack.
A stack is the ideal data structure to use when evaluating a postfix expression.
Errors and exceptions represent unusual or invalid processing.
The implementation of the collection operations should not affect the way users interact with the collection.
How we handle exceptional conditions determines whether the collection or the user of the collection controls the particular behavior.
For efficiency, an array-based stack implementation keeps the bottom of the stack at index 0.
Object reference variables can be used to create linked structures.
A linked list is composed of objects that each point to the next object in the list.
A linked list dynamically grows as needed and essentially has no capacity limitations.
The order in which references are changed is crucial to maintaining a linked list.
Dealing with the first node in a linked list often requires special handling.
Implementing a list with a sentinel node or dummy node as the first node eliminates the special cases dealing with the first node.
Objects that are stored in a collection should not contain any implementation details of the underlying data structure.
Any implementation of a collection can be used to solve a problem as long as it validly implements the appropriate operations.
A linked implementation of a stack adds and removes elements from one end of the linked list.
The java.util.Stack class is derived from Vector, which gives a stack inappropriate operations.
Problem and solution in teaching materials.
Why should a linked list node be separate from the element stored on the list?
It is unreasonable to assume that every object that we may want to put in a collection can be designed to cooperate with the collection implementation.
What do the LinkedStack and ArrayStack classes have in common?
Both the LinkedStack and ArrayStack classes implement the StackADT interface. This means that they both represent a stack collection, providing the necessary operations needed to use a stack.
What would be the time complexity of the push operation if we chose to push at the end of the list instead of the front?
To push at the end of the list, we would have to traverse the list to reach the last element. This traversal would cause the time complexity to be O(n). An alternative would be to modify the solution to add a rear reference that always pointed to the last
element in the list. This would help the time complexity for add but would have consequences if we try to remove the last element.
What impact would the use of sentinel nodes or dummy nodes have upon a doubly linked list implementation?
It would take two dummy records in a doubly linked list, one at the front and one at the rear, to eliminate the special cases when dealing with the first and last node.
How to expand capacity in arraystack?
The expandCapacity method is implemented to double the size of the array as needed. Of course since an array cannot be resized once it is instantiated, this method simply creates a new larger array, and then copies the contents of the old
array into the new one. It serves as a support method of the class and can therefore be implemented with private visibility.
To start with, change the arraystack into double size as needed.Then, use the for-loop to copy the content of the old array into the new one.
Last, make the new one is stack.
Code hosting

Summary of error for last week.
Linear search is always more effective than binary search.The answer should be false, for the situation of "n = 2".
Evaluate for my partner
- Advantage and problem in the blog:
- Concise and comprehensie
- Uncleary to the content
- Mould is amazing
- Advantage and problem in the code:
- Serious writing.
- Wonderful idea
- Too less
Learning situation of partner
- Learning content of partner:
- Algorithm
- Recursion
- HanoiTowers and maze
Anything else that want to say
- It's not easy to persere on utizing English to write a blog.But I'm getting used to doing this because of the benefit.
Academic progress check
| Code line number(increasing/accumulative) | Blog number(inc/acc) | studying time(inc/acc) | progress | |
|---|---|---|---|---|
| target | 5000lines | 30articles | 400hours | |
| First week | 180/180 | 1/1 | 20/20 | |
| Second week | 1049/1229 | 1/2 | 18/38 | |
| Third week | 1037/2266 | 3/7 | 22/60 | |
| Fourth week | 300/1300 | 2/9 | 30/90 |
20162314 《Program Design & Data Structures》Learning Summary Of The Fifth Week的更多相关文章
- 20162314 《Program Design & Data Structures》Learning Summary Of The Ninth Week
20162314 2017-2018-1 <Program Design & Data Structures>Learning Summary Of The Ninth Week ...
- 20162314 《Program Design & Data Structures》Learning Summary Of The Seventh Week
20162314 2017-2018-1 <Program Design & Data Structures>Learning Summary Of The Seventh Wee ...
- 20162314 《Program Design & Data Structures》Learning Summary Of The Second Week
20162314 2017-2018-1 <Program Design & Data Structures>Learning Summary Of The Second Week ...
- 20162314 《Program Design & Data Structures》Learning Summary Of The First Week
20162314 2017-2018-1 <Program Design & Data Structures>Learning Summary Of The First Week ...
- 20162314 《Program Design & Data Structures》Learning Summary Of The Eleventh Week
20162314 2017-2018-1 <Program Design & Data Structures>Learning Summary Of The Eleventh We ...
- 20162314 《Program Design & Data Structures》Learning Summary Of The Tenth Week
20162314 2017-2018-1 <Program Design & Data Structures>Learning Summary Of The Tenth Week ...
- 20162314 《Program Design & Data Structures》Learning Summary Of The Eighth Week
20162314 2017-2018-1 <Program Design & Data Structures>Learning Summary Of The Eighth Week ...
- 20182320《Program Design and Data Structures》Learning Summary Week9
20182320<Program Design and Data Structures>Learning Summary Week9 1.Summary of Textbook's Con ...
- 【Python学习笔记】Coursera课程《Python Data Structures》 密歇根大学 Charles Severance——Week6 Tuple课堂笔记
Coursera课程<Python Data Structures> 密歇根大学 Charles Severance Week6 Tuple 10 Tuples 10.1 Tuples A ...
随机推荐
- mysql sqlite3 postgresql 简明操作
安装 mysql $ sudo apt-get install mysql-server sqlite3 $ sudo apt-get install sqlite3 postgresql $ sud ...
- win7-x64上MySql的初次安装
1.官网:https://dev.mysql.com/downloads/mysql/下载对应的zip包 2.将包解压缩到本地,如:F:\mysql\mysql-8.0.15-winx64 3.配置环 ...
- Linux下onvif客户端获取ipc摄像头 GetServices:获取媒体地址(有的h265摄像头必须要这个接口)
GetServices:获取媒体地址(有些h265的摄像头必须用到这个接口,得到获取能力时没获取到的另一个媒体地址) 鉴权:但是在使用这个接口之前是需要鉴权的.ONVIF协议规定,部分接口需要鉴权,部 ...
- MAC系统常用快捷键 基本常用的都整理在这里了
写在前面 Mac系统中有几个比较特殊的功能键,和Win系统的区别也主要在这里比如在Win系统中我们常用的Ctrl键,在Mac系统中对应的不是长得比较像的Cnotrol,而是Command键,貌似也是M ...
- Redis简介和常见的面试题
redis介绍及特点 Redis是由意大利人Salvatore Sanfilippo开发的一款内存内存高速缓存数据库. Reids全称为:Remote Dictionary Server(远程数据服务 ...
- python-docx操作word文件(*.docx)
目录 基础操作 对象关系 添加样式 中文字体微软雅黑,西文字体Times New Roman 首行缩进 单独设置标题样式 设置超链接 参考文档 基础操作 from docx import Docume ...
- Java基础——类加载机制
什么叫类加载 JVM把 .class 字节码文件加载到内存,并进行相关的校验.解析.初始化,最终转换为虚拟机可用的JAVA类型的过程,称为JVM类加载机制. (当然,JVM并不关心class文件的来源 ...
- Python连接MySQL数据库执行sql语句时的参数问题
由于工作需要,今天写了一个Python小脚本,其中需要连接MySQL数据库,在执行sql命令时需要传递参数,结果出问题了.在网上查了一下,发现有以下几种方式传递参数: 一.直接把sql查询语句完整写入 ...
- 2017-2018-1 20155317 IPC
2017-2018-1 20155317 IPC - 共享内存 共享内存主要是通过映射机制实现的.以window系统调用为例子:Windows 下进程的地址空间在逻辑上是相互隔离的,但在物理上却是重叠 ...
- Django中表单的用法深探
[转载说明:原文排版不是很好,为方便阅读,改进了排版] django的表单设计真的很棒,涉及非常多的功能,今天介绍django较为主流的几种表单使用方法.注:本文中表单与form通用.模型与model ...


