20,182,334 2019-2020-1 "Object-oriented programming and data structures," the eighth week of learning summary
Learning content summary
The eighth week of learning various methods to find and sort of way.
Find : sequential search, binary search, binary sort tree search, hash lookup.
Sort : select sort, insertion sort, quick sort, bubble sort, merge sort and so on.
A lot of knowledge, but also more complicated, now, I have not quite learned to understand, although theoretical knowledge knows that, clearly, but with a specific code to achieve still feel a little weak and difficult.
You also learned ASL calculate the average search length, simply on ASL (average length) are summarized in this blog is mainly about the process and methods of calculation ASL hash lookup, feel learned a lot, to share it here after I saw.
Also we learned the results after discharge quickly sort written with theoretical knowledge, which is to do with the sort of thinking machine, a fuller understanding of the quick sort.
Various sort or find time complexity.
Textbook learning and problem-solving process
Question 1: useful textbook to define the type of comparable data, I was very puzzled, comparable is an interface, why would it be used to define a type?
Problem 1 Solution: Find and use jdk api again comparable:
Then I discovered that in fact he actually learned before and generic definition of a comparable type
almost, when mass participation pass in an int when there is no error, running out of the result is int type, when mass participation pass in time for the String type , the result of running out of the String type.
So I feel similar to basic and generic as possible behind a change, flexible type definition.
Question 2: There is no science to understand the principle of quick sort, quick discharge point in the process how to find, or how to change after that is quite vague.
Problem 2 Solution: To solve my problem, I again self-study, to complete a find relevant information and found a blog and write well: quick sort (java achieve)
This diagram illustrates the above problem reference point, usually for convenience, the first digit is defined as the reference point, behind this change is to rely on a reference point to change.
The above image shows how to change, starting with the digit after the reference point, first from right to left to find a number of less than 6, and then from left to right to find a number greater than 6, then swap them, exchanging a lot of times after that, the sorting is completed, the high efficiency of this sort method to improve the efficiency of the computer.
Question 3: teacher merge sort when running their own God, so I do not know how to do merge sort.
Question 3 Solution: still learning, surf the Internet blog: the Java implement merge sort - there are pictures and the truth of this blog is also said very carefully. A picture basically solved my problem:
This action figure is to say the number of unordered string separated into a multi-segment array, then sort each array, after twenty-two merger, re-ordering, and so forth, and finally become a whole array, the output out time is of the order.
Code debugging and problem solving in the process
Question 1: When there is a problem with recursion, the position of always want to find a few.
Problem 1 Solution: After correction for colorectal partners found out that I pass back an array subscript, so always minus one. After I returned value plus one, so that we can return to the exact value of the corresponding position.
- Question 2: Why binary search must be orderly?
- Problem 2 Solution:
Some columns above it can be seen that FIG., The so-called binary to find a middle position, and then looking for the value than the size, then after determining a first binary value and the last value, it is wanted to determine, it is necessary to ordered to compare after ordering.
Code hosting
Last week exam wrong question summary
Last week, no exams
Comments had students blog and code
- Pair this week learning
- 20182321
Pair Photo
- Pair learning content
- Finding and sorting together to complete the study.
- Together to solve problems in the book.
- Last week blog peer assessment case
Other (perception, thinking, etc.)
Through the study of data structures, I found myself java there are many problems, such as definitions or the type of call money, or to do experiments with the interface. When learning node, Node method or unskilled, but will use, but the content inside is still not very clear, so have to practice more. As for the structure of the data, I can understand the contents inside, but do not know how to use code to achieve, which allows me as a programmer, it is difficult. May be the time to learn java and data structures too tight, so many things I have not finished digesting the teacher would talk about new content, or the teacher will not talk about some things, thanks to self-learning, self-study is also okay, but not really time! ! Only the holidays see if I can learn once again to consolidate the current teacher trying to keep up with the pace.
Learning progress bar
The number of lines of code (add / accumulate) | Blog amount (add / accumulate) | Learning time (add / accumulate) | Important growth | |
---|---|---|---|---|
aims | 5000 rows | 30 | 400 hours | |
the first week | 212/212 | 2/2 | 17/17 | |
the second week | 132/344 | 2/4 | 17/34 | |
The third week | 689/1033 | 1/5 | 23/67 | |
the fourth week | 664/1697 | 2/7 | 20/87 | |
fifth week | 586/2283 | 2/9 | 20/107 | |
Sixth Week | 500/2783 | 1/10 | 26/133 | |
Week Seven | 2143 /4928 | 2/12 | 40/173 | |
Eighth Week | 3272 /8200 | 1/13 | 40/213 |
Plan study time: 29 hours
The actual study time: 40 hours
Improved: do not compromise, Sike in the end!