Overview of data structures and algorithms (basic concept)

  The basic concept of data structures

 

    "Data structure" is between a core curriculum between mathematics, computer hardware and software of the three.

  When solving a specific problem with your computer, generally need to go through the following steps: First, the specific problems abstracted from an appropriate mathematical model and algorithm design a mathematical model of this solution, and finally compile the program for testing and tuning until the final answer.

  Seeking the essence of the mathematical model is to analyze the problem, the object of the operation to extract and identify the relationship between these operations contains objects, then be described using the language of mathematics.

  Computer algorithms are closely related to the agency's data, algorithms are all attached to a specific data structure, data structure directly related to the selection and efficiency of the algorithm.

  Since the operand numerical problems involved are simple integer, real, or Boolean data type, so the main energy program designers focused on skill programming, without having to pay attention to the data structure. With the development of computer applications and the expansion of the field of software and hardware, non-numerical problems become more and more important. According to statistics, today's deal with non-numerical problems occupy more than 90 percent of the time machine. Data structures such problems involve more complex interrelationships between data elements generally can not be described by mathematical equations. Therefore, the key to solving these problems is no longer a mathematical analysis and computational methods, but to design the appropriate data structure, in order to effectively solve the problem.

  Non-numerical mathematical model is no longer a question of mathematical equations, but the data structures such as lists, trees, and the like of FIG.

  Concepts and terminology

    1. Data

      Data (Data) is a description of people using the symbols of text symbols, mathematical symbols, and other provisions on real-world things and their activities made. In computer science, the meaning of the data is very extensive, we can put all the information entered into the computer processed by a computer program, including text, tables, images, etc., are known as data.

     2. Data elements

      Data element (Data Element) are the basic units of the data. Under different conditions, but also data elements called elements, nodes, vertices, records. The node in the program as a whole is generally considered and processed.

     3. Data Objects

      Data objects (Date Object) is a collection of data elements of the same nature, it is a subset of the data. Whether infinite set of data elements is a finite set or data element composite composed of a plurality of data items, as long as the same nature, are the same data object.

     4. Data structure

      Data structure (Data Stucture) is an abstraction between the research data elements and the relationship of the relationship stored in the computer representation (i.e., logical and physical structure of data mechanism) and the structure adapted to define operation corresponding design algorithms, but also ensure that the new structure obtained after these operations is still the original structure types.

  Depending on the relationship of characteristics between data elements, usually four following basic structure

    1) a set of structure

     In the set configuration, the relationship between the data elements are "belong to the same set." A collection is a very loose relationship between the elements of a structure

    2) linear structure

     There is a one to one relationship between the data elements of a linear structure

    3) tree

     Many relationship exists between the data elements of the tree structure

    4) graphical structure

     Exists between data elements-many relationship graph structure, a network structure pattern structure is called the

  A data structure has two components: a collection of data elements, and the other is a set relationship

     The logical structure of the data

    The logical structure data (Logical Stucture) refers to a logical relationship between the elements of the data structure, which is a mathematical model abstracted from the concrete problem, it is independent of the computer memory. Logical structure data can be divided into four basic types: the collection structure, linear structures, and graphical tree structure. Tables and trees are the two most common and efficient data structures, many efficient algorithms can be used both to data structure design and implementation. Table is a linear structure (one to one), the tree (many relationship) and (many relationship) is a nonlinear structure.

    6. A data storage structure

    Data storage structure (Storage Stucture) is a logical structure of data stored in a computer memory, also called the physical structure. Achieve data storage structure to use computer programming language. Thus it depends on the specific computer language. Common storage methods can be divided into sequential storage and chain stores two kinds.

     Method sequential storage is logically adjacent elements stored in the physical positions of adjacent memory cells, the storage is referred to the sequential storage structure.

     The chain storage method is logically adjacent elements which do not require physical location adjacent the logical relationship between the elements indicated by the pointer field attached, is referred to the storage Storage Structure.

     Index storage method is to add an index file on the basis of the data file, indexed by the index table, this table may be divided into a sequential order of sub-list, which aims to improve the efficiency of the query in the query, to avoid blind search.

     Hash storage method is to establish some kind of mapping relationship between the storage address elements, so try to achieve one to one relationship between each element of each memory address.

    A data processing

    Data processing means for data search, insert, delete, merge operation, sorting, statistics, and other simple computing.  

    8. Data Type

   Data type (Data Type) is a concept closely related to the data structure in the program using high-level programming language, each variable, constant or expression corresponds to a certain type of data. Data types can be classified into two types: one type is non-atomic structure, as basic data types (integer, real, string, etc.); the other is the type of structure, the structure may be composed of a plurality of types, and can be decomposed. Structure type of decomposition may also be a non-structural configuration.

  The concept and characteristics of algorithms

    Defined algorithm

   Algorithm (Algorithm) refers in solving problems, steps must follow some mechanical problems result can be obtained (when the solution of the problem is given a solution, no solution is given when no solution conclusions) of the process. When faced with a problem, and the steps needed to find a way to solve this problem with a computer, a method algorithm is to solve this problem and steps.

    Three elements of the algorithm

    By the arithmetic operation, control structures, data structures, three elements

    Operations: arithmetic (addition, subtraction, multiplication, division), the relationship between the comparison (greater than, less than, equal to, not equal), logical operations (AND, OR, NOT), data transfer (input, output, assignment)

    When the sequence structure, select the structure (the operations are carried out in succession) (determined by the selection execution condition is satisfied), loop structure (also known as repetitive or iterative, some operations to be performed repeatedly until some condition is met: control structures End,)

    Data structures: the object is a data arithmetic operation, logical relationships between data, data storage and handling is a data structure

    The basic nature of the algorithm

   Representation of the algorithm satisfies the following properties:

     Purpose : Algorithms have a clear purpose, the algorithm can function assigned to it

     Step of : complex algorithms to complete its functions, the computer-executable by a series of steps consisting

     Ordering : the steps of the algorithm are sequential, not free to change the order of execution of the algorithm steps

     Limitation : Algorithm execution sequence is limited, comprising the step of the algorithm is limited

     Operability : algorithm always makes sense to operate certain objects, it changes state to fulfill its functions

   The basic features of the algorithm

     Finite nature : an algorithm must end after the execution of finite steps

      Uncertainty : under any circumstances, have only one path algorithm

      Feasibility : The operation can be achieved through a limited number of operations has been achieved through basic operations

      Zero or more inputs : input during execution of the algorithm to enter or input into the algorithm embedded

      One or more outputs : the information processing algorithms result obtained

   Algorithm design requirements

    Correctness: For all the legitimate input data can meet the requirements of the outcome

    Readability: Firstly, for people to read and exchange, followed by the computer to execute

    Robustness: illegal input data, the algorithm should react appropriately, or be processed, instead of generating output inexplicable

    High efficiency and low memory: the time required for execution and implementation of the algorithm maximum storage space

 

Guess you like

Origin www.cnblogs.com/huan30/p/12347412.html