Basic Data Structures

Source: Internet
Author: User

Feel their memory is very bad appearance, reading does not make notes as if not read the same, so decided to read the technical class of books, should make good notes.

1.IP address and domain name: If the IP address is likened to a social security number, the domain name is the name of the holder.

2. Port: Specify a device has 216, that is, 65,536 ports, each port corresponds to a unique program.

0~1024 is occupied by the operating system, so the actual programming is generally used after the port number 1024.

3. Documentation notes: A note format that can be extracted to form a program document. The format is as follows:

/**     Note Content *  /

4. Greatest common Divisor Program

1PublicClassMaxcommonfactor {2public int MCF (int m,< Span style= "color: #0000ff;" >int N) {3 int i = Math.min (m, n); 4 for (; I >= 1;i--) Span style= "color: #008080;" >5 if (m%i = 0 && n%i = 0) 6 return I; 7 return I; 8 }9}        

5. Arrays:

Static initialization:

1 数据类型[] 数组名称 = {值1,值2,......,值n};

Dynamic initialization:

New data type [length];

Cases:

Charchar[3];

The default value of a Boolean array is flase, and the default value for the other 7 base type array is 0, and the initial value of the composite data type is NULL.

The length of the array gets:

Array name. length

Decimal conversion to binary:

Publicclass dec2binary { Public void d2b (int N) { new int[ 32int i = 0; while (n! = 0; n/= 2;} for (int j = i-1;j >= 0;j--  

6. Multidimensional arrays

1) Declaration of multidimensional arrays

Data type []  array name; data type []  array name []; data type  array name [];

2) Multidimensional Array initialization

Data type []  newnew data type [length of first dimension] [length of second dimension]; 

3) Example:

intint[2int[3int[4];  

4) get the array length

take a two-dimensional array as an example // dimension m.length// second-dimension length m[i].length     

Basic Data Structures

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.