20172320 2017-2018-2 "Java Programming" Tenth Week study summary

Source: Internet
Author: User

20172320 2017-2018-2 "Java Program Design" Tenth Week Study summary textbook study summary

1. A collection is an object, similar to a repository that holds other objects
-The isomorphism of the set means that this collection holds all objects of the same type, and heterogeneous means that objects of various types can be saved
2. Abstract data type (ADT) is a collection of data and the specific operations implemented on that data.
-ADT has a name, a range, and a set of operations that are allowed to perform
-The actions that can be performed on ADT are separated from the underlying implementation
3, a dynamic data structure with a chain to achieve, dynamic data structure size scale with the need to grow and shrink
4. Linear data structure
-Queues: Similar to lists, with limited access to the elements of the queue, is a linear data structure that is managed in FIFO mode
-Stack: A linear data structure that manages the information in a LIFO manner
5. Nonlinear data structure
-Tree: A tree is a nonlinear data structure that consists of a root node and multiple nodes that make up a hierarchy. All nodes outside the root node are called internal nodes, and nodes with no child nodes are called leaf nodes. The root node is at the top level and the leaf node is at the bottom. Binary tree and tree operations are different
-figure: There is no initial entry point similar to the root node. The connection of one node to another is called an edge, and the number of edges that connect each node in a graph is generally unlimited
6. Java Collection Class API: Defines several classes that represent collections of different types
-Generics: Java Collection class The class in ARI is defined as generic and refers to the type of object managed by a collection to be determined when the collection object is instantiated, generics guarantee compatibility of object types in the collection

Problems encountered in teaching materials and the solution process '
  • Question 1: Queues and stacks?
  • Problem 1 Solution:
  • Queue: A queue is a linear table that allows only one end of an operation to be inserted, while the other is being deleted at the other end
    (1) The one end of the allowed delete is called the team header
    (2) One end of the allowed insert is called the tail of the queue
    (3) When there are no elements in the queue called empty queues
  • Stack: a linear table that restricts insert and delete operations only at one end of a table
    (1) The end of the insert, delete is usually called the top of the stack (top), the other end is called the bottom of the stack (Bottom).
    (2) When there are no elements in the table called Empty stacks
  • function: Stack: 1. For symbol matching
    2. for calculating algebraic expressions
    3. Construct an expression
    4. For function calls
    (2, 3 can be solved with a binary tree)

  • The same point: 1. are linear structures.
    2. The insert operation is limited to the end of the table.
    3. All can be implemented by sequential structure and chained structure.
    4. The time complexity of both insertion and deletion is O (1), which is the same for both spatial complexity.
    5. Multi-link stack and multi-chain queue management mode can be the same.
  • Different points: 1. Deleting the data element is different, the deletion of the stack is done at the end of the table, and the deletion of the queue is done at the table header.
    2. The application scenarios of the common stacks include the solution of parentheses, the conversion and evaluation of expressions, function invocation and recursive implementation, and depth-first search traversal, etc. common queue scenarios include management of various resources in computer systems, management of message buffers and breadth-first search traversal.
    3. The sequential stack enables multi-stack space sharing, while sequential queues cannot.

  • Question 2: Understanding of Generics
  • Problem 2 Solution:
    Essence: Controls the type of the formal parameter restriction for a parameterized type (in the case of not creating a new type, by the different types specified by the generic type). That is, during generics use, the data type of the operation is specified as a parameter, which can be used in classes, interfaces, and methods
    Example: See reference link
    Feature: Generics are only valid at compile-time
    Use:-generic class: Used in the definition of a class, the generic can complete the operation of a set of classes to open the same interface
    -generic interface: Basically the same as the definition and use of generic classes, generic interfaces are often used in various classes of producers
    -Generic mode
    Pros:-Advance the run-time issue to the compile period
    -Forced type conversions are avoided
    -Optimized program design, solve the yellow warning line problem, make the procedure more secure

Problems in code debugging and resolution process last week's quiz summary
  • What does the following method compute? Assume the method is called initially with i = 0
    public int Question9 (String A, char b, int i)
    {
    if (i = = A.length ()) return 0;
    else if (b = = A.charat (i)) return Question9 (A, B, i+1) + 1;
    else return Question9 (A, B, i+1);
    }
    A. The length of String a
    B. The length of String a concatenated with char b
    C. The number of times char B appears in String a
    D. Returns 1 if Char B appears in String A at least once, and 0 otherwise
    E. The char which appears at location I in String a
    Analysis: This method compares each character in string A to char B until I reaches the length of string A. 1 is added to each of the matching return values.

  • A recursive algorithm is superior to an iterative algorithm along which of the following criteria?
    A. The recursive algorithm is easier to debug
    B. The recursive algorithm is computationally more efficient
    C. The recursive algorithm is more elegant
    D. The recursive algorithm requires less memory to execute
    E. All of the above
    Analysis: For the sake of simplicity, mathematics usually recursively defines functions

  • The difference between direct and indirect recursion is
    A. Direct recursion occurs when a method invokes itself; Indirect recursion occurs when there was an intervening method
    B. Indirect recursion occurs when a method invokes itself; Direct recursion occurs when there was an intervening method
    C. Direct recursion only occurs with methods declared to be private; Indirect recursion can occur with methods declared to being private, protected, or public
    D. Indirect recursion only occurs with methods declared to be private; Direct recursion can occur with methods declared to being private, protected, or public
    E. None of the above
    Analysis: Direct recursion means that the method calls itself directly instead of using an intermediary method. Indirect recursion occurs when there is one or more mediation methods before the original method is called again.

    Pairing and mutual evaluation
reviewed the classmates blog and code
    • This week's study of the knot
      20172327
      20172317
    • Pairs of learning content
      Textbook 11th, Chapter 12
      ? read Chapters 11.1-11.6, 12.1-12.3
      To complete the self-test after class, and refer to the answer study
      Finish the exercises after class.
      Complete programming Project: At least complete PP11.1, PP11.2, PP12.1, PP12.9
Learning progress Bar
lines of code (new/cumulative) Blog Volume (Add/accumulate) Learning Time (new/cumulative) Important Growth
Goal 5000 rows 30 Articles 400 hours
First week 67/67 1/4 20/20
Second week 328/395 1/5 20/40
Third week 523/851 1/6 20/60
Week Four 1070/1921 1/7 20/80
Week Five 608/2529 1/8 10/90
Week Six 608/2899 1/9 20/110
Seventh Week 429/3328 1/10 20/130
Eighth Week 804/4131 1/11 20/150
Nineth Week 521/4652 1/12 20/170
Tenth Week 600/5252 1/13 20/190
Resources
    • Java Programming and Data Structure Tutorial (eighth edition)
    • Blue Ink Cloud Class class
    • The difference between a queue and a stack
    • The similarities and differences between stacks and queues
    • Java generics in-depth explanation

20172320 2017-2018-2 "Java Programming" Tenth Week study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.