20172304 2017-2018-2 "Program Design and Data Structure" Week 8 Learning Summary

Student ID 2017-2018-2 "Program Design and Data Structure" Week 8 Learning Summary

Textbook learning content summary

 本周主要讲了多态,面向对象的编程最重要的就是封装,多态,和继承。多态的对象可以指向多种类型。具有很高的灵活性。多态可以由继承和接口实现。由继承实现多态,可以用父类定义一个对象,而这个对象可以指向子类的对象。而接口实现多态,则是在实现接口的类中,由接口定义的对象可以指向其中的对象。还介绍了两种排序方法。一种选择排序法,一种插入排序法。选择排序法是扫描整个数列找到最小值。然后依次与第一,第二,第三位的数交换位置。而插入排序法则是,先比较前两个数,然后将最小值放在前面,然后依次进行。还介绍了两种搜索方式,一种是线性搜索,一种是二分搜索。线性搜索就是一个一个的依次进行排查。而二分搜索就是要先将数列进行排序,不断地取中点元素,最后找到想要的数值。

Problems and Solving Processes in Teaching Materials Learning

  • Question 1: How to solve the problem of data exchange in the sorting process, there will be a place for data exchange when sorting. But can't directly swap like this. int[1]=int[2];int[2]=int[1]; This will not achieve the purpose of data exchange.
  • Solution to problem 1: Later, I saw example 10.4Sorting, which introduced the concept of exchange variables, that is, before exchanging data, one of the data is now stored in the exchange variable, and then the data such as "temp=int[2] "int[2]=int[1]"int[1}=temp"
    .

Problems and solutions in code debugging

  • Problem 1: The output is not very correct when doing homework 10.5.

  • Solution to problem 1: Homework pp10.5 was originally used to sort the movie names in movies, so I pasted the example in Chapter 8 but found that the output was wrong, so I reworked the toString method in DVDCollection. I wrote it, and later rewritten the toString method in the class to solve it.

code hosting

(screenshot of the running result of the statistics.sh script)

Summary of last week's exam mistakes

  • wrong question 1


    Analysis: This question is good to know.

  • wrong question 2


    Analysis: In this question, I thought that the Object class has no parent class, so all the selected classes have only 0 or 1 parent class, but the teacher said that the Object class is not considered, so I was wrong.

  • wrong question 3


    Analysis: This question is slightly beyond the outline, which belongs to the content of Chapter 10. But I now understand a little bit, that is, the object of the parent class can be used in the subclass, but when using it, you need to specifically determine the class to which the object belongs, which is polymorphism.

  • wrong question 4


    Analysis: This is wrong, because subclasses can use the private variables of the superclass without using the super reserved word.

  • wrong question 5

  • Analysis: This question says that subclasses cannot redefine the data types of inherited variables, which is wrong.
  • wrong question 6

  • Analysis: This question is wrong because subclasses can not only access protected objects and public objects in the parent class but also access private properties in the parent class.
  • wrong question 7

  • Resolution: This is wrong because not only classes can be derived, but also interfaces, unless decorated with the final modifier.
  • wrong question 8

  • Resolution: The methods of the abstract class must be fully implemented, not just inherited.

Pairing and mutual evaluation

paired object

  • 20172301 Guo Kai
  • Points to learn or problems to correct:
  • 20172328 Li Xinyu

Others (perception, thinking, etc., optional)

 本周不仅进行了第十章的学习同时又开课一个编程项目,那就是结对编程--四则运算,这真的是很烧脑。不过还好总算是坚持了下来,不知道前方还有多少艰难险阻等着我们,不过开弓没有回头箭,既然选择了这一职业,那也没有办法,只能坚持的走下去。希望我能承受住越来越多的考验,最后能成长为一名合格的程序员。

learning progress bar

Lines of code (added/accumulated) Blog volume (new/cumulative) Study time (added/accumulated) important growth
Target 5000 lines 30 articles 400 hours
the first week 75/200 1/2 20/20
the second week 338/500 1/4 18/38
The third week 516/1000 1/7 22/60
the fourth week 1296/1300 1/4 30/90
fifth week 615/2839 1/5 20/110
Week 6 610/3449 2/7 20/130
Week 7 719/4108 1/8 30/160
eighth week
  • Planned study time: 30 hours

  • Actual study time: 25 hours

References

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325162985&siteId=291194637