Data Structure basics 1

Source: Internet
Author: User

Data structures are used by computers to store and organize data. A good data structure can improve the running or storage efficiency. The data structure is often related to the retrieval algorithm and indexing technology.

The design process of a data structure is divided into abstraction layer, data structure layer, and implementation layer. The abstraction layer refers to the abstraction data type layer, which discusses the logical structure of data and its operations, the data structure layer and Implementation Layer discuss the representation of a data structure, the storage details of a computer, and the implementation of operations.

A Data Structure is organized by data elements based on certain logical connections. The description of the logical relationship between data elements is called the logical structure of data. Data must be stored in a computer, and the data storage structure is the implementation form of the data structure, which is expressed in a computer; in addition, to discuss a data structure, we must also discuss the operations performed on this type of data to make sense.

Data structure refers to the relationship between data elements in the same data element class. The data structures are logical structures, storage structures (physical structures), and data operations. The logical structure of data refers to the description of the relationship between data. Sometimes, the logical structure is referred to as the data structure. The logical structure is defined as (K, R) (or (d, S). k is the finite set of data elements, and r is the finite set of relations on K.

The relationship between data elements is called structure. There are four types of basic structures: Set, linear structure, tree structure, and graph structure (mesh structure ). Tree structures and graphic structures are all called non-linear structures. The data elements in the set structure have no other relationships except the same type. There is a one-to-one relationship between elements in a linear structure, one-to-many relationship between elements in a tree structure, and many-to-many relationship between elements in a graphic structure. In the graphic structure, the number of frontend knots and subsequent knots of each node can be any number of knots. The representation (image) in a computer is called the physical (storage) structure of data. It includes the representation of data elements and the representation of relations. There are two different Representation Methods for the relationship between data elements: sequential and non-sequential images, and two different storage structures are obtained: sequential and chained storage structures. Sequential storage method: stores logically adjacent nodes in storage units adjacent to physical locations. The logical relationship between nodes is reflected by the adjacent relationship of storage units, the resulting storage representation is called a sequential storage structure. The sequential storage structure is the most basic storage representation method. It is usually implemented by arrays in programming languages. Link storage method: it does not require logically adjacent nodes to be physically adjacent. The logical relationship between nodes is represented by an additional pointer field. The resulting storage representation is called the chain storage structure. The chain storage structure is usually implemented by the pointer type in the programming language. Index storage method: In addition to creating storage node information, an additional index table is created to identify the address of the node. Hash Storage Method: calculates the storage address of the node based on the key words of the node. Different data structures have different operation sets, but the following operations must be performed: 1. Structure generation; 2. structure destruction; 3. Search for data elements that meet the specified conditions in the structure; 4. Insert new data elements into the structure; 5. Delete existing data elements in the structure; 6. Traverse Common Data Structures


In programming, several variables of the same type are organized in an orderly manner to facilitate processing. The collections of these sort-by-order data elements are called arrays. In C, arrays are constructed data types. An array can be divided into multiple array elements, which can be basic data type or constructor type. Therefore, Arrays can be divided into numeric arrays, character arrays, pointer arrays, Structured arrays, and other categories based on the types of array elements.


Is a special linear table that can only be inserted and deleted at one end. It stores data according to the principle of "back-in-first-out". The data that comes first is pushed to the bottom of the stack, and the final data is placed at the top of the stack, data is popped up from the top of the stack when data needs to be read (the last data is read by the first one ).


A special linear table that can be deleted only at the front of the table and inserted at the back end of the table (rear. The end of the insert operation is called the end of the team, and the end of the delete operation is called the head of the team. When there are no elements in a queue, it is called an empty queue.

Linked List)

It is a non-sequential storage structure of physical storage units. The logical sequence of data elements is achieved through the pointer link sequence in the linked list. A linked list consists of a series of nodes (each element in a linked list is called a node), which can be dynamically generated at runtime. Each node consists of two parts: one is the data domain that stores data elements, and the other is the pointer domain that stores the next node address.


Is a collection K that contains n (n> 0) nodes, and defines a relationship N in k, n meets the following conditions:

(1) There is only one node K0. For relation N, there is no precursor. K0 is the root node of the tree. Root for short ). (2) Except for K0, each node in K has only one precursor for relation n.

(3) Each node in K can have m successor for relation n (m> = 0 ).


A graph consists of a finite set V of a node and a set E of an edge. In order to distinguish it from the tree structure, the node is often called a vertex in the graph structure, and the edge is an ordered even pair of vertex. If there is an edge between two vertices, the two vertices are adjacent.


In computer science, heap is a special tree-shaped data structure, with each node having a value. Generally, the data structure of a heap refers to a binary heap. Heap is characterized by the smallest (or largest) value of the root node, and the two subtree of the root node is also a heap.


If a record with the same keyword and K exists in the structure, it must be stored at the location of F (k. Therefore, you can directly obtain the queried records without comparing them. The corresponding relationship F is called a hash function, and the table created based on this idea is a hash function.

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: 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.