20172329 2018-2019 "Java software architecture and data structure" first week study summary

Source: Internet
Author: User
Tags cpu usage

2018-2019-20172329 "Java software architecture and data structure" first week study summary

In this semester is already sophomore, also has entered the study specialized course core time, at this stage, we should know oneself the study situation, according to own learning ability to make the different plan, obtains to the self-ability enhancement. Let's start a new semester!

Summary of learning contents of textbook Java software structure and data structure Chapter I: overview

First, software development
1. Software Engineering: A science of high-quality software development technology and theory.
2. Solve the problem: control the development process, to achieve high-quality software.
3. Software Engineering Objectives: (1) to solve the correctness of the problem, (2) timely in the budget to provide solutions, (3) to give a high-quality solution, (4) in a reasonable manner to complete the above things.
4. Characteristics of Software Quality: (1) correctness (2) reliability (3) robustness (4) Availability (5) maintainability (6) repeatability (7) Portability (8) Operational efficiency

Second, data structure
1. program = data structure + algorithm;
Little story: Pascal's father--nicklaus Wirth won the Turing Award through this sentence!
2. Software = program + Engineering;
3. Data structure: How the computer stores and organizes data.

Java software architecture and data structure Chapter II: Algorithm Analysis

First, algorithm efficiency analysis
1. The efficiency of the algorithm is usually expressed in terms of CPU usage time;
2. Algorithm analysis is to classify the algorithm from the angle of efficiency;
3. The growth function indicates the use of time or space relative to the size of the problem;
4. Growth function: (1) We want to optimize the value, (2) The more commonly concerned about CPU usage time; (3) The growth function represents the relationship between the problem size (n) and the value that you want to optimize.

Second, large O notation
1. The growth function represents the time complexity or spatial complexity of the algorithm.
2. Progressive complexity is called the order of the algorithm.
Note:

    • (1) The time complexity with order is n^2, which is recorded as O (n^2).
    • (2) The order of the algorithm is the constant that ignores the increment function of the algorithm and other minor items, only the main item is reserved.
    • (3) Regardless of whether the problem is large or small, run the assignment statement and the IF statement once, with a complexity of O (1).
    • (4) Loop statements and method invocation statements can result in higher order growth functions.
    • (5) Two algorithms with the same class are considered to have the same efficiency, but their growth functions are not necessarily the same.
      3. Example:

Three, the comparison of growth function
1. Faster processors, which do not affect the master, will only add constants to the growth function and still need to focus on algorithmic analysis.
2 cases:

Note: Among the 3.16, 2.15, 3.3 algorithms, √10≈3.162277660168379, 3√10≈2.1544, log2 (Ten) =LG (2)/LG (2) =1/LG
When 3.N is relatively small, the comparison of various growth functions

When n is large, the comparison of various growth functions

Iv. Analysis of Time complexity (emphasis)
1. To analyze the loop run, first determine the order n of the loop body, and then multiply it by the number of times the loop needs to run.
Example: an example of a time complexity of O (n)

for(int count = 0;count<n;count++){//*复杂度为O(1)的步骤系列}

Example: If the complexity of the loop is on a number of levels (the time complexity is O (log n)

count = 1;while(count < n){count *=2;//复杂度为O(1)的步骤系列}

2. Analysis of the complexity of nested loops
Example: Time complexity of O (n^2)

for(int count = 0;count < n;count++){   for(int count2 = 0;count2<n;count2++)    {        //复杂度为O(1)的步骤系列    }}

3. Analysis of complexity of method calls
Example: Time complexity of O (n^2)

for(int count = 0;count<n;count++){    printsum(count);}public void printsum(int count){    int sum = 0;    for(int I = 1;I<count;I++)        sum += I;    System.out.println(sum);}

Five, time complexity of the calculation law (emphasis)
T1 (n) and T2 (n) for the program segment and program segment 2, respectively, with a total run time of T (N)
1. Addition criteria: T (n,m) =t1 (n) +t2 (n)
2. Multiplication criteria: T (n) =t1 (n) *t2 (n)
3. Special case: The average time complexity of the algorithm, the worst-case time complexity of the algorithm.

Problems in teaching materials learning and the solving process
    • Question 1: Could there be a case where the complexity of a method call is O (1), can it be understood as a mathematical advanced line n-th square, and then open the n-th root?
      For example, if the time complexity of the code is O (1)
for(int count = 0;count<n;count++){    {        for(j=1;j<=count;j++)             {                printsum(count);            }       }}public void printsum(int count){    int a=0;   while(a^2<=count)       a++;}
    • Issue 1 resolution Process:
      In the book of the answer, I think it is possible to think, because it is a computer problem evolved mathematical problems, time complexity is the number of cycles, as well, the number of times is calculated by a series of calculations, and the calculation of the problem is only a computer problem of a means of interpretation, So I think I can totally understand that.
Textbook Layout Exercise Solution

EX 2.1 What is the order of the following growth functions?
a.10n^2+100n+1000
Solution: Because the progressive complexity is called the order of the algorithm, the order of the growth function is: n^2.
B.10n^3-7
Answer: Because the n^3 growth rate is the fastest, so the order is: n^3
C.2^n+100n^3
Answer: Because n^3 faster than 2^n, so the order is: n^3
D.n^2 log (N)
Answer: Order: n^2 log (n)

EX 2.4 Please determine the growth function and order of the following code snippet

for(int count = 0 ; count < n ; count++)    for(int count2 = 0 ; count2 < n ; count2 = count2 + 2)        {            System.out.println(count,count2);        }}

Answer:

    • The growth function is: F (n) = (n^2)/2
    • Order is: n^2
      Solution: Because the number of times that the inner loop needs to be N/2, the number of times the outer loop needs to be performed is n, so the multiplication principle (T (n) =t1 (n) *t2 (n)) that is taught by the teacher is: F (n) = (n^2)/2 and the order is related to the highest order of the growth function So the minor and constant entries are ignored. So the order is n^2.

EX 2.5 Please determine the growth function and order of the following code snippet

for(int count = 0 ; count < n ; count++)    for(int count2 = 0 ; count2 < n ; count2 = count2 * 2)        {            System.out.println(count,count2);        }}

Answer:

    • Growth function: F (n) =n log2 (n)
    • Order: N log2 (N)
      Solution: Because the inner loop needs n times, the number of outer loops is LOG2 (n), so the multiplication principle (T (n) =t1 (n) *t2 (n)) is available, the growth function is: F (n) =n log2 (n), and because the order is related to the highest order of the growth function, the secondary and constant items are ignored. So the order is n log2 (n).
Pairing and mutual evaluation
    • This week's study of the knot
      • 20172316 Zhao Chen
    • Blogs that are worth learning or questions:
      • Content detailed slightly properly;
      • Code debugging links more detailed;
    • Based on the scoring criteria, I scored this blog: 5 points. The score is as follows:
    1. Correct use of markdown syntax (plus 1 points):
    2. Complete features in the template (plus 1 points)
    3. Problem and solution process in textbook learning, one question plus 1 points
    4. Code debugging problems and resolution process, a problem plus 1 points

      • 20172316 Tang Caiming
    • Blogs that are worth learning or questions:
      • Content detailed slightly properly;
      • Code debugging links more detailed;
    • Based on the scoring criteria, I scored this blog: 9 points. The score is as follows:
    1. Correct use of markdown syntax (plus 1 points):
    2. Complete features in the template (plus 1 points)
    3. Problem and solution process in textbook learning, one question plus 1 points
    4. Code debugging problems and resolution process, a problem plus 1 points
Sentiment

Ah, the new semester again, we have to study again, so happy ha ha haha. Although it sounds a bit false, indeed, a little fake, but the school is very happy, and students can play together, very happy to play Ah! Then can study hard, in the home feel every day playing games, do not want to learn, I hope in the new semester can continue to work hard, serious study, no late study, I have to give their own self-learning time to learn, I hope that they can learn more useful things to make their life better, to raise their own!

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 6/6
Resources

Blue Ink Cloud Class class
Java programming

20172329 2018-2019 "Java software architecture and data structure" first week study summary

Related Article

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.