Study number 2017-2018-2 "program design and data Structure" the fourth week study summary textbook Learning content Summary
The sixth chapter mainly studies the concept of list and some methods of management list.
List Collection
- The difference between a linked list and a collection of lists: A linked list is an implementation strategy that uses references to create links between objects.
In the previous study, the list was used to implement the stack and queue collection separately. A collection of lists is a conceptual notation,
The idea is to make things organized in a linear list of ways. Like stacks and queues, lists can also be implemented using a linked list or array.
- The list collection does not have an intrinsic capacity size, and it can grow as needed.
- Stacks and queues are linear structures that can be thought of as lists, but whose elements can only be added and deleted at the end. The list collection is more generalized, and elements can be added and removed at the middle and end of the list.
- There are 3 types of list collections:
- A sequence list (cordered list) whose elements are sorted by an intrinsic characteristic of the element.
- Unordered lists (unordered list) whose elements do not have an intrinsic order, and the elements are sorted in any way that the user chooses.
- An indexed list (indexed list) whose elements can be referenced by a numeric index to maintain a contiguous number of index values.
- Ordered tables: Lists are sorted based on a key value. For any element that has been added to an ordered table, as long as the key value of the element is given, the list is
Defines all the key values for an element, it has a fixed position in the list.
- Unordered list: The position of each element is not based on any intrinsic characteristics of the element. But the elements in the list are still placed in a special order, except that the order and elements
Nothing in itself. The user of the list determines the order of the elements. Figure 6.2 is a concept diagram of an unordered list. A new element can be placed at the front or end of the list, or
is inserted after a specific element in the list.
- Indexed lists: There are no intrinsic lines between elements that determine their order in the list. The user of the list determines the order of the elements. However, in addition, its
Each element can be referenced from a number that is incremented from 0 to the end of the list from the beginning of the list header. The new element can be added to the list of any
A position, including the front and end of the list. Each self-list changes, and the index values are adjusted accordingly to maintain order and continuity. Note that the fundamental difference between an indexed list and an array is that the index value of the index list is always contiguous. If removed or inserted, the other elements are shifted to eliminate gaps or to vacate positions.
List in the Java collection API
- The list classes provided by the Java Collection API are primarily support index lists. To some extent, these classes overlap with unordered tables.
However, it is important to note that the Java API does not have any classes that can directly implement the ordered list described above.
Both ArrayList and LinkedList implement the Java.util.List interface.
An example of a list provided by the Java API.
- Using the unordered list: Learning Plan
- Index list: Josephus problem (when the events in the list are not fetched sequentially but every I element is extracted, until the end, how to find the order of these events)
List ADT
- Many common operations can be defined for all types of lists. The difference between these operations is how to add elements.
- There are some operations that are common to both ordered and unordered lists. The difference between a sequence table and an unordered list is usually mainly reflected in adding elements to the list.
- In an ordered list, you only need to specify the new element that you want to add. The position of the element in the list depends on its key value.
- The unordered list supports the 3 variants of the add operation. You can add elements to the front end of the list, to the end, or to the back of an existing element in the list.
Problems in teaching materials learning and the solving process
- Issue 1: Design essentials
Can a list be both an ordered and an indexed list? Maybe, but it doesn't make any sense. If a list is both an ordered and an indexed list, what happens if the client application tries to add one by one elements at an index, or modifies an element at an index (so that the element is not in the correct order)? which rule has higher precedence, index position or order?
- Issue 1 Solution: XXXXXX
- Question 2: Finally, the save and load methods are used to write the Programofstudy object to a file and read it from a file (unlike the text-based IO operation seen in the previous example, a process called serialization is used to read and write to the object in the form of a binary stream. As a result, you can store the current state of an object with just a few lines of code. This means that all the courses currently stored in the Learning plan are stored as part of the object.
Note that the Programosudy and course classes implement the Serializable interface. In order for an object to be stored using serialization, its class must implement serializable. There is no method in the serializable interface, it simply indicates that the object can be transferred to a serialized representation. The ArrayList and Lmkedlist classes also implement the Serializable interface.
Serialization
public class Course implements Serializable
Indicates that the class can be serialized to
Serializable interface does not contain any methods
- Issue 2 Solution: XXXXXX
- ...
Problems in code debugging and the resolution process
Question 1:
- Issue 1 Solution: XXXXXX
- Question 2:xxxxxx
- Issue 2 Solution: XXXXXX
...
Code Hosting
(run result of statistics.sh script)
Last week's summary of the wrong quiz
- Wrong question 1 and reason, understand the situation
Analytic: The title means that public features should be as low-level as possible in the class hierarchy, minimizing maintenance effort. But the public characteristics should be placed in the parent class, or even in the first class, and these are the top level of the class hierarchy, mainly do not understand the good class hierarchy, which led to the error of this topic.
- Wrong question 2 and reason, understand the situation
...
Pair and peer reviews:
- Blogs that are worth learning or questions:
- Something worth learning or doing in your code:
- This week's study of the knot
reviewed the classmates blog and code
- Last week's blog comments on the situation
Our learning model back to the last semester, and constantly in advance in the study of content, in fact, pre-class preview is good, but I think the blog submission time
Can put in this chapter of the class after the submission, after all, if we have all the questions before the class is written, time is a little tight, and if
is to finish the lesson, the answer to your own textbook questions will be more clear, so I feel that can be completed after the last blog next week to study the requirements,
But deadline can be fixed in a day or two after the class, so that it will not be so nervous, but also to achieve the effect of the preview.
Learning progress Bar
|
|
lines of code (new/cumulative) |
Blog Volume (Add/accumulate) |
Learning Time (new/cumulative) |
Goal |
5000 rows |
30 Articles |
400 hours |
|
First week |
0/0 |
1/1 |
10/10 |
|
Second week |
326/326 |
1/2 |
18/28 |
Learning in a little bit of depth |
Third week |
784/1110 |
1/3 |
25/53 |
|
Resources
20172310 2017-2018 "program design and data Structure" (next) Fourth Week study summary