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. 2.高并发教程-基础篇-之nginx+mysql实现负载均衡和读写分离

    技巧提示:mysql读写分离搭建好之后,配合nginx的负载均衡,可以高效的mysql的集群性能,同时免去麻烦的query分流.比如,sever1收到的请求就专门链接slave1从mysql读取数据, ...

  2. 第一次码java感想及前三次作业总结

    写在前面 嗯,首先是java,这学期第一次oo作业布置下来的周末才开始看的,第一次作业因此写得有些手忙脚乱.不过大概看了一遍后发现比c好用,入门更简单吧,好多操作直接import一下就能用了,码代码的 ...

  3. Linux学习笔记(第七章)

    目录相关操作 pwd -P 显示出实际工作目录,pwd 显示链接路径 mkdir -m 配置新建文件的权限 例:mkdir -m 711 testmkdir -p 建立多层目录,无需一层一层建立 rm ...

  4. hive的实践部分

      一.hive的事务 (1)什么是事务 要知道hive的事务,首先要知道什么是transaction(事务)?事务就是一组单元化操作,这些操作要么都执行,要么都不执行,是一个不可分割的工作单位. 事 ...

  5. 多线程Java Socket编程示例

    package org.merit.test.socket; import java.io.BufferedReader; import java.io.IOException; import jav ...

  6. Caffe中Layer注册机制

    Caffe内部维护一个注册表用于查找特定Layer对应的工厂函数(Layer Factory的设计用到了设计模式里的工厂模式).Caffe的Layer注册表是一组键值对(key, value)( La ...

  7. 柯朗微积分与数学分析习题选解(1.3 节 b)

    一直在读<陶哲轩实分析>,陶的书非常的严谨,环环相扣,但是也有个缺点就是计算性的例子和应用方面的例子太少了.所以就又找了本柯朗的<微积分与数学分析>搭配着看.柯朗的书的习题与陶 ...

  8. window下查杀占用端口的进程

    一. 查找占用的端口进程号,比如8080 C:> netstat –ano|findstr 8080 C:\Users\chry>netstat -ano | findstr 8080 T ...

  9. js 日期,时间函数 及相关运算大全

    一.在js中如何比较两个时间字符串的大小 方法一: function CompareDate(d1,d2){     return ((new Date(d1.replace(/-/g,"/ ...

  10. Unity3d — — UGUI之Box Collider自适应大小

    NGUI下给Sprite/image添加collider后能自适应大小,但是在UGUI下Collider是默认在(0,0)位置,size为0 因此写了个简单的脚本,效果如下(最后附代码) 1.如下图添 ...