Data Structure and algorithm 1

Source: Internet
Author: User
1. Data Structure Data structure refers to a set of data elements that have (exist) certain links (Relationships) between each other. The interaction between elements is called a logical structure. There are four basic types of logical structure of data elements: set: the data elements in the structure belong to the same set, and there is no relationship between them. Linear Structure: there are data elements in the structure.

1. Data Structure Data structure refers to a set of data elements that have (exist) certain links (Relationships) between each other. The interaction between elements is called a logical structure. There are four basic types of logical structure of data elements: set: the data elements in the structure belong to the same set, and there is no relationship between them. Linear Structure: there are data elements in the structure.

1. Data Structure

A Data Structure refers to a set of data elements that have (exist) a certain relationship (relationship) between each other. The interaction between elements is called a logical structure. There are four basic types of logical structures for data elements:

Set: the data element in the structure has no relation except "belong to the same set.

Linear Structure: there is a one-to-one relationship between data elements in the structure.

Tree Structure: there is a one-to-many relationship between data elements in the structure.

Graph structure or mesh structure: There is a many-to-many relationship between data elements in the organization

2. storage of data structures

The storage of data structures in computer memory includes the storage of data elements and representation of the relationship between elements.

There are two different Representation Methods for the relationship between elements in the computer: Sequential Representation and non-sequential representation. Two different storage structures are obtained: sequential Storage Structure and chained storage structure.

Sequential storage structure: the logical structure (relationship) of data elements is expressed by the relative position of data elements in the memory ).

Chain Storage Structure: Add a pointer to each data element to store the address of another element. This pointer is used to represent the logical structure (relationship) of the data element ).

3. logical and physical structures

Physical Structure of Logical Structure

Linear table linear Storage Structure

Chained Storage Structure

Please refer to the following link for more information:

Tree linear Storage Structure

Chained Storage Structure

Please refer to the following link for more information:

Figure composite Storage Structure

Please refer to the following link for more information:

Logical Structure of data

┌ ── ─

Non-linear structure

Please refer to the following link for more information:

┃ Restricted linear table promotion set tree structure graph Structure

When there are too many threads, there are too many threads, too many threads.

General Linear table stack and queue String Array generalized Table General tree Binary Tree directed graph undirected graph

4. Data Structure Calculation

The main operations of the data structure include:

1. create a Data Structure

2. destroy a Data Structure

3. delete a data element from a Data Structure

4. insert a data element into a Data Structure

5. access a Data Structure)

6. modify a data structure (Data Element in) (modify)

7. sort a data structure (sort)

8. search a Data Structure)

5. linear table (linear list)

Is a finite sequence composed of n (n> = 0) data elements of the same type a1, a2....... As (a1, a2 ,..., ai-1, ai, ai + 1 ,..., an) Here, the data element ai (1 <= I <= n) is just an abstract symbol. Its specific meaning can be different under different circumstances. It can be an atomic type, it can also be a structure type, but the data elements in the same line table must belong to the same data object. In addition, there is an ordinal relationship between adjacent data elements in a linear table, that is, for non-null linear

Table (a1, a2 ,..., ai-1, ai, ai + 1 ,..., an ). table ai-1, ahead of ai, said ai-1 is the direct precursor of ai, said ai, is the direct follow-up of ai-1. Except for the first element a1, each element ai has only one node ai-1 called the direct precursor, except for the last element, each element ai has only one node known as direct successor ai + 1. the number n of elements in a linear table is defined as the length of a linear table. When n = 0, it is called an empty table. The features of a linear table are as follows:

Identity: A linear table consists of similar data elements. Each ai must belong to the same data object.

Poor: A linear table consists of a finite number of data elements. The table length is the number of data elements in the table.

Ordering: there is an ordinal relationship between adjacent data elements in a linear table (ai, ai + 1)

From this we can see that a linear table is the simplest data structure, because the data structures are determined by the intuitive and orderly relationship between the first and second orders; A linear table is the most common data structure, because matrices, arrays, strings: stacks, queues, and so on all conform to linear conditions.

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.