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

  • 20162310

  • 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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 20182320《Program Design and Data Structures》Learning Summary Week9

    20182320<Program Design and Data Structures>Learning Summary Week9 1.Summary of Textbook's Con ...

  9. 【Python学习笔记】Coursera课程《Python Data Structures》 密歇根大学 Charles Severance——Week6 Tuple课堂笔记

    Coursera课程<Python Data Structures> 密歇根大学 Charles Severance Week6 Tuple 10 Tuples 10.1 Tuples A ...

随机推荐

  1. 怎么用CIFilter给图片加上各种各样的滤镜_2

    上一篇讲了怎么找到能用的的滤镜和大概怎么去寻找... 这里接着说如何详细地给图片加滤镜效果..前的准备工作... . 1. 在找到想用的滤镜名字之后.须要知道这个滤镜究竟须要什么參数. . 例如以下图 ...

  2. KVM虚拟机IO处理过程(二) ----QEMU/KVM I/O 处理过程

    接着KVM虚拟机IO处理过程中Guest Vm IO处理过程(http://blog.csdn.net/dashulu/article/details/16820281),本篇文章主要描述IO从gue ...

  3. boost::bind 学习

    最近学习了太多与MacOS与Iphone相关的东西,因为不会有太多人有兴趣,学习的平台又是MacOS,不太喜欢MacOS下的输入法,所以写下来的东西少了很多.    等我学习的东西慢慢的与平台无关的时 ...

  4. 第二章 Js语法

    来博客园已经有二年了,看了看自己发布的内容,少的可怜.完全背离了自己的初衷.how time fly,想着自己两年后,还是没写什么东西,岂不是白白浪费时间!有感于王宝强说的那句话,“好好活着,做有意义 ...

  5. 求助:将以下ES5格式代码转换为ES6格式!!!

    function Slider(id){     //属性     //  1. 通过id获取元素对象(大盒子)     this.bigBox = document.getElementById(i ...

  6. golang cgo 使用总结

    原文地址 CGO 提供了 golang 和 C 语言相互调用的机制.某些第三方库可能只有 C/C++ 的实现,完全用纯 golang 的实现可能工程浩大,这时候 CGO 就派上用场了.可以通 CGO ...

  7. WebUploader在IE9中文件选择按钮点击没反应

    一.问题: 最近做的公司项目里,用户环境一直用的火狐,但是实际的用户群体都是银行人员 政府部门怎么也要用 IE,而且还有一些用的IE版本是古董版本IE9 IE9 相比 IE8 多了图像渲染等,无法兼容 ...

  8. 25-[jQuery]-事件

    重点:jQuery事件绑定on().bind()与delegate() 方法详解 1.jquery的事件 <!DOCTYPE html> <html lang="en&qu ...

  9. POJ2079 Triangle

    题面 题解 我什么时候会过这种东西???(逃 旋转卡壳板子题(听说这个算法有十六种读音??? 我是真的忘了这道题目怎么做了,挂个\(blog\),等我学会了再写题解 我的代码里居然有注释???好像还是 ...

  10. spark日志配置及问题排查方式。

    此文已由作者岳猛授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 任何时候日志都是定位问题的关键,spark也不会例外,合适的配置和获取spark的driver,am,及exe ...