C # Common data structure and algorithm summary _c# tutorial

Source: Internet
Author: User

1. Data

Data is the carrier of information in the external world, which can be recognized, processed and stored by computer. In real life is also the raw material of our products.

The data in the computer includes the numerical data, the picture, the audio-visual material and so on.

2. Data elements and data items

Data element is the basic unit of data, which is usually treated as a whole in the process of computer processing.

Data item: A data element typically consists of one or more data items.

For example, a database table: (Student), it has id,name,sex,age,address and other fields, and this table has more than one row of data. We usually call these fields data items, each row of data

is called a data element. In some cases data elements are also called elements, nodes, records, and so on.

Data items are divided into two categories: (1) Elementary items, (2) combinations [which can be divided into smaller items, such as people can be divided into Europeans, Asians, Africans]

3. Data structure

A data structure (Structure) is a collection of elements of one or more specific relationships that exist between each other.

It is well known that no data element in a computer can be single or isolated, and there is a certain relationship between them. As with the human system, man cannot be isolated and not connected with the outside world.

The data structure is divided into four kinds:

(1) Set [set]

(2) linear structure [Linear Structure] (common linear structure data, database storage data)

(3) tree-shaped structure [tree Structure] (trees, like human inheritance, in the computer XML file storage data is the most typical)

(4) graphic structure [Graphic Structure] (graphic structure is also relatively complex, because there are many pairs of relationships, computer network topology)

4. Data Objects

Data object, a collection of data elements of the same nature, is a subset of data. {"AA", "BB", "CC", "DD"} we can consider it as a data object, a collection of character lengths.

5. Data type

Data type, from the above data object we can derive the concept of data type, a lot of time data types in the C#,java and other advanced program language is said more

Data types are divided into two categories:

(1) Non-structural atomic type (in C # which is the basic data type, such as Int,string,long, etc.)

(2) A struct type that can be composed of multiple struct types and can be decomposed. struct types can contain structural types and unstructured atomic types

6. Algorithm

Algorithm: A series of clear instructions to solve the problem, the algorithm represents a systematic way to describe the problem-solving strategy mechanism.

The advantages and disadvantages of an algorithm can be measured by the complexity of space and time. Where the algorithm has five characteristics:

(1) Poor: Each instruction in the algorithm has a limited number of executions, with limited time to execute each instruction

(2) Certainty: Each step of the algorithm must have an exact definition

(3) Input: An algorithm has 0 or more inputs, to describe the initial operation of the object, the so-called 0 input is the algorithm itself to define the initial conditions

(4) Output: An algorithm has one or more outputs to reflect the results of the processing of input data. The algorithm without output is meaningless.

(5) Feasibility: Any computational steps performed in the algorithm can be decomposed into basic executable steps that can be done in a limited time by each computational step

Algorithm classification: Basic algorithm, data structure algorithm, number theory and algebraic algorithm, computational geometry algorithm, graph theory algorithm, dynamic rule and data analysis, encryption algorithm, sorting algorithm, retrieval algorithm, randomization algorithm, parallel algorithm

7. Degree of complexity

The complexity of the algorithm can be measured with time complexity and space complexity.

Time complexity: The time complexity of the algorithm refers to the time resources that the algorithm needs to consume

Space complexity: The spatial complexity of the algorithm refers to the space resources that the algorithm needs to consume

8. Physical structure of data

The physical structure of the data (physical Structure), also known as the storage structure, is the representation and storage of data in the computer, including the representation and storage of data elements and the representation and storage of data element relationships.

Data structure storage is divided into: (1) sequential storage structure. (2) Chain-type storage structure

Sequential storage structure: the logical relationship between data elements is represented by the relative position of the data elements on the computer memory, and the logical adjacent data elements are generally stored in the adjacent storage units of the physical location.

The array structure in C # is a typical way of sequential storage structure.

Chained storage structure: Adjacent elements do not need to be adjacent to the physical storage location unit, they maintain relationships by storing the addresses of adjacent data elements. Address we usually call it a reference (Reference)

Note: This article is just a summary of some of the concepts of data structure, when we learn programming, we often say that the concepts of data, complexity, etc., as to this data, complexity and so on exactly what things we have not studied, here summed up some knowledge points can help you understand these concepts.

The above C # commonly used data structure and algorithm summary is small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.

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.