Data structure and algorithm (i.)

Source: Internet
Author: User

11 Logical Structure:

A: The collection structure data elements have no other relationship than they belong to a collection

B: A one-to-one relationship between linear structure data elements

C: There is a one-to-many hierarchical relationship between tree-structured data elements

D: A Many-to-many relationship between graphical structure data elements

2 Physical Structure

A: Sequential storage structure is the data structure stored in the address continuous storage unit, the logical relationship between the database and the physical relationship is consistent

B: Chain storage structure is to store data structure in any storage unit, this group of storage units can be continuous, or can be discontinuous

Two algorithm large o derivation

1: With constant 1 represents all addition constants (execution time constant)

2: In the modified run Count function, only the highest stratum is retained

3: If the highest stratum is present and not 1, the constant multiplied by the item is removed

  

A constant order

int n=100,sum=0; A

sum = (1+n) *N/2; A

Time complexity O (1)

b Linear Order

for (i=0;i<n;i++) {/* Executes a statement with a time complexity of O (1) */}//n times

Time complexity O (n)

C Logarithmic order

int count=1;

while (count<n) {count = count*2}

Time complexity O (LOGN)

D Square Order

for (i=0;i<n;i++) {//n times

      

for (j=0;j<n;j++) {//n times

}

}

Time complexity O (n^2)

Common time complexity O (1) < O (Logn) < O (n) < O (Nlogn) < O (n^2) < O (n^3) < O (2^n) < O (n!) < O (n^n)

  

Data structure and algorithm (i.)

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.