Data Structures (C Language Version) Chapter 1

Chapter 1 Introduction
1.1 What is a data structure
Data structure : a collection of data elements that have one or more specific relationships with each other
Data structure = data object + structure
1.2 Basic concepts and terms
Data : is a symbolic representation of objective things, In computer science, it refers to the general term for all symbols that can be input into a computer and processed by a program.
Data element : is the basic unit of data, usually considered and processed in a computer program as a whole. A data element can be composed of several data items , for example, the bibliographic information of a book is a data element, and each item of bibliographic information (such as book title, author name, etc.) is a data item. A data item is the smallest indivisible unit of data.
Data object : is a collection of data elements of the same nature, which is a subset of data.
The different characteristics of different relationships between data elements usually have the following four structures
(1) Sets The data elements in the structure have no other relationship except the relationship of "belonging to the same set".
(2) Linear structure There is a one-to-one relationship between the data elements in the structure.
(3) Tree structure There is a one-to-many relationship between the data elements in the structure.
(4) There is a many-to-many relationship between data elements in a graph-like structure or a network-like structure .
Abstract data type (abstract data type, ADT for short)
format :
ADT abstract data type name { data object: <definition of data object> data relationship: <definition of data relationship> basic operation: <definition of basic operation> } ADT abstract data type name basic operation name (parameter list) initial condition: < Initial condition description> Operation result: <Operation structure description> 1.3 Representation and implementation of abstract data types (1) Predefined constants and types #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 # define OVERFLOW -2 (2) The representation (storage structure) of the data structure is described by a type definition ( typedef ). The data type convention is ElemType, which is defined by the user when using this data type. (3) Algorithms of basic operations are described by functions of the following form: function type function name (function parameter list) { //algorithm description statement sequence }//function name 1.4 Algorithms and Algorithm Analysis 1.41 Algorithms Algorithms are the steps to solve specific problems A description of , which is a finite sequence of instructions, where each instruction represents one or more operations. Five characteristics of the algorithm:

























(1) Finiteness An algorithm must always (for any valid input value) end after executing finite steps, and each step can be completed in finite time.
(2) Inputs with the same certainty can only get the same output.
(3) Feasibility An algorithm is feasible, that is, the operations described in the algorithm can be realized by performing a limited number of basic operations that have been implemented.
(4) Inputs An algorithm has zero or more inputs.
(5) Output An algorithm has one or more outputs.
1.42 Requirements for algorithm design
(1) Correctness
(2) Readability
(3) Robustness
(4) Efficiency and low storage requirements
1.43 Measurement of algorithm efficiency
Time complexity
Common time complexity: O(1)<O( logn)<O(n)<O(nlogn)<O(n^2)
<O(n^3)
<O(n^n)
<O(2^n)
1.44 Storage space requirements of the algorithm
Space complexity

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324036936&siteId=291194637