20172315 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

  • Post-binding references to polymorphism are delayed until the program runs.
  • The efficiency of post-binding is lower than that of compilation-phase binding
  • Inheritance can be used to implement polymorphism
  • Interfaces can be used to implement polymorphism
  • Selection sort implements sorting by comparing sizes and swapping positions
  • Insertion sort realizes sorting by comparing the size and moving the position in turn
  • Both selection sort and insertion sort have n-square efficiency
  • Linear search does not require an ordered array, searches are performed one by one
  • Binary search requires an ordered sequence, and binary search is performed
  • Binary search is more efficient than linear search

Problems and Solving Processes in Teaching Materials Learning

  • Question 1: I don't understand the meaning of the Speaker current = new Philosopher(); statement in the book
  • Problem 1 solution: The statement is to point the Philosopher object to the Speaker interface reference variable.
  • Question 2: How to proceed if the object of binary search is even
  • Solution to problem 2: After the teacher explained in class, he knew that the first of the two midpoints was used for binary search.

Problems and solutions in code debugging

  • Question 1: XXXXXX
  • Problem 1 Solution: XXXXXX
  • Question 2: XXXXXX
  • Problem 2 Solution: XXXXXX
  • ...

code hosting

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

Summary of last week's exam mistakes

  • Wrong question 1 and reasons, understand the situation
    If a programmer writes a class wanting it to be extended by another programmer, then this programmer must
    A . change private methods and instance data to be protected
    B . change public methods and instance data to be protected
    C . change all methods to be protected
    D . change the class to be protected
    E . none of the above, the programmer does not have to change anything
    Correct Answer: A
    Your answer: C
    Protected items can be protected by any child of the class that defines them class access, while private items cannot be accessed by any other class.
  • Wrong question 2 and why, understand the situation
    Abstract methods are used when defining A
    . interface classes B
    . derived classes
    C . classes that have no constructor
    D . arrays
    E . classes that have no methods A class that defines some of its components, but leaves other methods for implementation.


  • Wrong question 3 and reasons, understand the situation
    Which of the following is true regarding Java classes?
    A . All classes must have 1 parent but may have any number of children (derived or extended) classes
    B . All classes must have 1 child (derived or extended) extended) class but may have any number of parent classes
    C . All classes must have 1 parent class and may have a single child (derived or extended) class
    D . All classes can have any number (0 or more) of parent classes and any number of children (derived or extended) classes
    E . All classes can have either 0 or 1 parent class and any number of children (derived or extended) classes
    Correct answer: A
    Your answer: E
    Java supports inheritance, but not multiple inheritance , so a Java class can have any number of subclass elements, but only one parent class element.
  • Wrong question 4 and reasons, understand the situation
    A derived class has access to all of the methods of the parent class, but only the protected or public instance data of the parent class.
    A . true
    B . false
    Correct answer: B
    Your answer: A
    Since methods can also be declared private, any private method cannot be accessed by derived classes.
  • Wrong question 5 and reasons, understand the situation
    Using the reserved word, super, one can
    A . access a parent class'constructor(s)
    B . access a parent class'methods and instance data
    C . access a child class'constructor(s)
    D . access a child class' methods and instance data
    E . none of the above
    Correct answer: E
    Your answer: B The
    super reserved word provides a mechanism to access the parent class' methods and instance data (whether they are hidden or not). In addition, you can use super to access the superclass's constructor.

    Pairing and mutual evaluation

Review Template:

  • Worth learning or questions from the blog:
    • xxx
    • xxx
    • ...
  • Worth learning or problems in the code:
    • xxx
    • xxx
    • ...
  • Based on the scoring criteria, I give this blog a score: XX points. The scores are as follows: xxx

Reviewed classmates blog and code

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 200/200 2/2 20/20
the second week 287/481 2/4 18/38
The third week 320/801 3/7 22/60
the fourth week 900/1600 2/9 30/90
fifth week 807/2407 2/11 40/130
Week 6 619/3023 2/13 40/170
Week 7 621/3644 2/15 40/210
eighth week 805/4364 2/17 40/250

References

Guess you like

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