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. ABAP术语-Authorization Profile

    Authorization Profile 原文:http://www.cnblogs.com/qiangsheng/archive/2007/12/21/1008992.html Element o ...

  2. jQuery带缩略图轮播效果图片切换带缩略图

    以上为效果图 HTML代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /& ...

  3. Qt样式总结

    说明 将Qt样式进行一下总结, 以后逐步更新 QPushbutton QPushbutton setStyleSheet("QPushButton{ border:1px solid #40 ...

  4. react中手动重置redux

    前段时间使用redux在react-native中,安卓后退两次关闭后redux未清空的问题,一直觉得处理的不够优雅,没有根本解决问题. 后来发现再退出登录后,也有部分数据因为redux的逻辑处理数据 ...

  5. mfc 类的析构函数

     析构函数  自定义析构函数 一.析构函数 析构函数(destructor) 与构造函数相反,当对象生命周期结束时(例如对象所在的函数已调用完毕),系统自动执行析构函数.析构函数往往用来做“清理善 ...

  6. 3992: [SDOI2015]序列统计

    3992: [SDOI2015]序列统计 链接 分析: 给定一个集和s,求多少个长度为n的序列,满足序列中每个数都属于s,并且所有数的乘积模m等于x. 设$f=\sum\limits_{i=0}^{n ...

  7. P5231 [JSOI2012]玄武密码

    P5231 [JSOI2012]玄武密码 链接 分析: 首先对所有询问串建立AC自动机,然后扫描一遍母串,在AC自动机上走,没走到一个点,标记这个点走过了,并且它的fail树上的祖先节点也可以访问到( ...

  8. Python的进阶:copy与deepcopy区别

    copy()与deepcopy()之间的区分必须要涉及到python对于数据的存储方式. 首先直接上结论: —–我们寻常意义的复制就是深复制,即将被复制对象完全再复制一遍作为独立的新个体单独存在.所以 ...

  9. How to implement a custom PropertyEditor so that it supports Appearance rules provided by the ConditionalAppearance module

    https://www.devexpress.com/Support/Center/Question/Details/T505528/how-to-implement-a-custom-propert ...

  10. 树莓派UPS-18650,添加时钟

    1.简介 UPS-18650 是一个专门为树莓派(以下简称 pi)所设计的 UPS 电源,采用两颗标准 的 18650 锂电池进行供电,支持外部电源插入检测,支持边充边放,既插上外部电源时, pi 由 ...