"Data Structure" (Yan Wei-Min Wu Weimin) study notes - the first chapter

Chapter One            Introduction

 

1.1   What is a data structure

Briefly, the data structure is a programming problems subject of Non numerical calculation of the operation target computer and the relationship between them and the like operations.

 

1.2   Basic Concepts and Terminology

Data (Data ) is a symbol objective things, in computer science refers to all symbols for input into the computer and a computer program process in general. It is a computer program of processing "raw material."

Data element (Data Element ) is the basic unit of data, it is typically considered as a whole and processed in a computer program. Sometimes, a data element may be a plurality of data items ( Data Item ) composed data items are indivisible minimum unit of data.

Data object (Object Data ) is a collection of data elements of the same nature, it is a subset of the data.

Data structure (Data Structure ) is the presence of one or more data elements of the particular relationship between each set. In any problem, the data elements are not isolated, but there is a relationship between them. This relationship between each data element referred to as structure ( Structure ) .

 

The relationship between the data elements of different characteristics, typically have the following four types of the basic structure:

(1)       Collection: between data elements in addition to the relationship between structure "belong to a set," and nothing other relationships;

(2)       linear structure: there is a relationship between data elements of a structure;

(3)       a tree structure: the existence of a relationship between a plurality of data elements of the structure;

(4)       FIG structure or mesh structure: a plurality of relationships between a plurality of data elements of the structure.

 

It is defined as data structures: a tuple data structure is

Data_Structure = (D, S)

Wherein, D is a finite set of data elements, S is a finite set of relations on D.

"Relationship" structure is described in the definition of logical relationships between data elements, so-called data logical structure .

Represents a data structure (known as an image) referred to in the computer data in the physical structure , also known as the storage structure . It includes representation and representation of the relationship between data elements.

Relationships between data elements of two different representations in the computer of the subsequent image and non-image sequence , and thereby obtain two different storage structure: sequential storage structure and the chain storage structure .

Any design an algorithm depends on the selected data (logical) structure, and the algorithm depends on the storage structure employed.

 

Abstract data types can be represented by the following triples:

(D, S, P)

Wherein, D is a data object, S is set on the relationship between the D, P D is the basic operation of the set.

Abstract data type in the format:

ADT abstract data type name {

Data objects : <object definition data>

Relationship data <Relationship definition data>:

Basic Operation : <define the basic operation>

} The ADT abstract data type name

Wherein, the basic operation is defined format:

Basic operation name (parameter list)

Initial conditions: <described initial condition>

Result: <described operation result>

There are two basic operating parameters: only the assigned parameter values ​​for the input operation; reference parameter & beginning, may be provided in addition to the input value, the operation result will be returned. "Initial conditions" describes conditions before operation execution data structures and parameters to be satisfied, not satisfied, then the operation fails, and returns the appropriate error message. "Result" described after the operation is completed normally, and the change of status of a data structure of results should be returned. If the initial condition is empty, it is omitted.

 

1.3   algorithm and algorithm analysis

1.3.1          Algorithm

Algorithm (algorithm) is a description of the steps to solve a specific problem, which is a finite sequence of instructions, where each instruction represents one or more operations; an algorithm has the following characteristics:

(1)           finite nature : an algorithm must always (for any legitimate input values) ends after the execution of finite steps, and each step can be completed within a finite time.

(2)           uncertainty : the algorithm in each instruction must have the exact meaning, the reader will not have time to understand ambiguity. And, in any condition, the algorithm only only one execution path, i.e. only yield the same output for the same input.

(3)           Feasibility : an algorithm can do it, i.e. the algorithm described operations are performed may be implemented by a finite basic operation has been achieved.

(4)           Input : an algorithm zero or more inputs, the inputs from a particular set of objects.

(5)           Output : An algorithm has one or more outputs that are comfortable with the same amount of certain relationships.

 

1.3.2          algorithm design requirements

A "good" algorithm should achieve the following objectives:

(1)           the validity (correctness) algorithm should meet the needs of specific problems.

(2)           readability (readability) algorithm is mainly for people to read and exchange, followed by the computer to perform.

(3)           robust lines (robustness is) when the input data is illegal, the algorithm or can react appropriately processed without causing output inexplicable.

(4)           efficiency and low memory requirements efficiency refers to the execution time of the algorithm, the amount of memory storage space requirements refer to the maximum during the execution of the algorithm required.

 

1.3.3          algorithm efficiency metric

In general, the number of the basic algorithm operation is repeated n is a function of the size of the problem F (n), referred to as a time metric algorithm

T(n) = O(f(n))

N represents a problem which increases with the size, execution time of the algorithm is the same growth rates and f (n) growth, called asymptotic time complexity of the algorithm (asymptotic time complexity), referred to as time complexity.

Typically time complexity discussion, refers to the time of the worst-case complexity.

 

1.3.4          storage space requirements of the algorithm

Metric algorithm storage space required is referred to the complexity of the space (space complexity), referred to as

S(n) = O(f(n))

Where n is the scale of the problem (or size).

In general, if the space occupied rely on specific input, are by worst-case analysis.

 

Guess you like

Origin www.cnblogs.com/Tom-1103/p/11817297.html