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 ...
随机推荐
- nagios 在nrpe中自定义脚本
监控第三方端口(22000) #!/bin/bash#author:xiaoweige#check 140 22000 result=`sleep 1|telnet 10.2.1.140 22000| ...
- 单片机C程序优化
单片机C程序优化 对程序进行优化,通常是指优化程序代码或程序执行速度.优化代码和优化速度实际上是一个予盾的统一.一般是优化了代码的尺寸,就会带来执行时间的增加:如果优化了程序的执行速度,通常会带来代码 ...
- mysql/mariadb学习记录——创建删除数据库、表的基本命令
查看已有的数据库: mysql> show databases; +--------------------+ | Database | +--------------------+ | inf ...
- lightbox用法
示例代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...
- JavaScript总结(八)
表单验证 表单验证是JavaScript最常用.最有用的功能之一.在表单内容提交之前进行验证,可以降低服务器处理器的压力,缩短用户等待的时间.表单校验中第一个要考虑的问题是:什么时候捕获表单的录入错误 ...
- 如何启动 EDB*Plus
磨砺技术珠矶,践行数据之道,追求卓越价值 回到上一级页面: PostgreSQL基础知识与基本操作索引页 回到顶级页面:PostgreSQL索引页 由于EnterpriseDB公司的网站上讲的 ...
- 洛谷 P1198 [JSOI2008]最大数
洛谷 P1198 [JSOI2008]最大数 题目描述 现在请求你维护一个数列,要求提供以下两种操作: 1. 查询操作. 语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值. ...
- 2_C语言中的数据类型 (五)char
1.1 char类型 1.1.1 char常量,变量 char c:定义一个char变量 ‘a’,char的常量 Char的本质就是一个整数,一个只有1个字节大小的整数 ...
- 【正经向】NOIP2017烤后总结
[正经向]NOIP2017烤后总结 Warning: 合法的评论(举例): 博主辣么juruo还来参加NOIP,不要脸 不合法的评论(举例): %%%%%博主太强了,我菜爆了 博主将删除不合法评论,& ...
- 我用 Python 爬取微信好友,最后发现一个大秘密
前言 你身处的环境是什么样,你就会成为什么样的人.现在人们日常生活基本上离不开微信,但微信不单单是一个即时通讯软件,微信更像是虚拟的现实世界.你所处的朋友圈是怎么样,慢慢你的思想也会变的怎么样.最近在 ...


