"Big Talk Data Structure" note (1)--Introduction to data structure, algorithm

Source: Internet
Author: User

Chapter One introduction to Data structure

Basic concepts and terminology DataData is a symbol that describes objective things, is an object that can be manipulated in a computer, a set of symbols that can be recognized by a computer and entered for processing by a computer. In other words, the data is a symbol and has two prerequisites: 1. Can be entered into the computer 2. Can be processed by a computer program Data ElementsA data element is a basic unit of meaning that makes up data and is usually treated as a whole in a computer. Also known as records. Data ItemA data element can consist of several data items. A data item is the smallest unit of data that is inseparable. Data ObjectsA data object is a collection of data elements of the same nature and a subset of the data. Data StructureA data structure is a collection of elements that have one or more specific relationships to each other. logical structure and physical structure Logical StructureLogical structure refers to the relationship between data elements in a data object. The logical structure is divided into the following four types:
1. The data elements in the collection structure collection structure are not related to each other except for the same collection. 2. The data elements in linear structures are a one-to-one relationship. 3. There is a one-to-many hierarchical relationship between data elements in a tree-shaped tree structure. 4. The graphical structure of the graphical structure of the data elements are many-to-many relationships. Physical Structure (storage structure)The physical structure refers to the storage form of the logical structure of the data in the computer. is actually how to store the data elements in the computer's memory. Memory is mainly for memory, such as hard disk, floppy disk, CD and other external memory data organization is usually described by the file structure. There are two types of data structure storage: 1. Sequential storage sequential Storage structure: The data element is stored in the address continuous storage unit, the logical relationship between the data and the physical relationship is consistent. An array is such a sequential storage structure.2. Chain-StoreChain storage structure is to store data elements in arbitrary storage units, the set of storage units can be continuous, or can be discontinuous. The logical structure is problem-oriented, and the physical structure is computer-oriented, and its basic goal is to store the data and its logical relationship in the memory of the computer. Abstract data Types Data TypeA data type is a set of values that are of the same nature and a generic term that defines some operations on this collection. Abstract data TypesAbstract data types refer to a mathematical model and a set of operations defined in the model. The definition of an abstract data type depends only on its set of logical attributes, regardless of how it is represented and implemented within the computer. Abstract data types embody the characteristics of problem decomposition, abstraction and information hiding in program design. Describes the standard format for abstract data types: Chapter Two algorithm algorithmAn algorithm is a description of the solution steps for a particular problem, represented as a finite sequence of instructions in a computer, and each instruction represents one or more operations.   features of the algorithmThe algorithm has five basic characteristics: input, output, poor, deterministic and feasible Input/OutputThe algorithm has 0 or more inputs and has at least one or more outputs. have poor sexThere is a poor sex refers to the algorithm after performing a limited number of steps, automatically end without an infinite loop, and each step in an acceptable time to complete. DeterministicDeterministic means that each step of the algorithm has a definite meaning, and there is no ambiguity of two. FeasibilityThe feasibility of each step of the algorithm must be feasible, that is, each step can be completed by the execution of a finite number of times. Requirements for algorithmic design correctness"Correct" is divided into the following four levels of 1. The algorithm program has no syntax errors. 2. The algorithm program for the legitimate input data can be produced to meet the requirements of the output results. 3. Algorithmic procedures for illegal input data can be obtained to meet the specifications of the results. 4. The algorithm program for carefully selected, even difficult test data have to meet the requirements of the output results. readability RobustnessRobustness means that when the input data is not valid, the algorithm can also make relevant processing, rather than produce abnormal or inexplicable results.   high time efficiency and low storage capacity the measure method of algorithm efficiency post-mortem statistical methodsThis method can determine the efficiency of the algorithm by comparing the running time of the program programmed by the computer timer with the well-designed test program and data. Bad reviews, not considered. Pre-analysis and estimation methodsBefore the computer program is compiled, the algorithm is estimated according to the statistical method. The run time of a program depends on the quality of the algorithm and the input scale of the problem. Therefore, when analyzing the running time of an algorithm, it is important to associate the basic operation quantity with the input scale, that is, the number of basic operations must be represented as the function of the input scale.   progressive growth of functionsWhen judging the efficiency of an algorithm, constants and other minor items in a function can often be ignored, and more attention should be paid to the order of the main item (the highest). time complexity of the algorithm definition derivation of the large O-order method constant OrderThe time complexity of sequential structures is the constant order. Linear OrderN-Times single-variable loop is O (n) Logarithmic orderThe time complexity in the following example is O (logn) Square OrderThe time complexity in the following example is an O (n2) Example: Common time Complexity worst case and average situationThe worst-case run time is a guarantee that the run time will not be broken again. In the application, this is one of the most important requirements, usually, unless specifically specified, the runtime that we refer to is the worst-case run time. The average run time is the most meaningful in all cases because it is the desired run time. spatial complexity of algorithmsThe spatial complexity of the algorithm is realized by calculating the storage space required by the algorithm, and the computational formula for the spatial complexity of the algorithm is as follows: S (n) = O (f (n)), where n is the scale of the problem, and F (n) is the function of the statement about the storage space occupied by N.

"Big Talk Data Structure" note (1)--Introduction to data structure, algorithm

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.