Data structure and algorithm notes (1) Basic concepts

Source: Internet
Author: User

1. What is a data structure to solve a specific problem with a computer requires the following several steps:
    1. Abstract an appropriate mathematical model from the specific problem;
    2. Design an algorithm to solve this mathematical model;
    3. The process of compiling;
    4. Test, adjust until you get the final answer.
Seeking the essence of a mathematical model: analyzing the problem, from whichthe object that extracts the operation, and find out theserelationships that are contained between operand objectsAnd thento describe in a mathematical language。 Many problem solving are finally transformed into solving mathematical equations or mathematical equations. For example, the mathematical model of the stress in the beam frame structure is a linear equation group. The mathematical model for predicting population growth is the differential equation. However: When the computer enters the field of non-numerical computing, especially when it is used in management, the relationship between the computer's operating objects cannot be described by mathematical equations.The mathematical model of non-numerical calculation problem is the data structure that this course will discuss。Data Structureis a studynon-numerical calculationProgramming problems when dealing with themanipulating Objectsand between them.Relationships and OperationsAnd so on the subject.
    • The center of solving the problem of numerical calculation: the establishment of appropriate mathematical model.
    • The center of solving non-numerical computing problems: Finding the right data structure
2. The discussion of the content data structure of data structure research generally involves the following three aspects:
    1. Data members and their logical relationship to each other, also known as the logical structure of data , referred to as the structure;
    2. The storage representation of data members and their relationships in computer memory, also known as the physical structure of data, is referred to as the storage structure ;
    3. The action applied to the data structure.

3. Basic concepts and terminology
    • Data: Is a symbolic representation of information. In computer science, it refers to all the symbols that can be entered into a computer and processed by a computer program. Numeric type + non-numeric type
    • Data element: is the basic unit of data, which is usually considered and processed as a whole in computer programs. A data element can consist of several data items. A data item is an indivisible minimum unit of data.
    • Data object: Is a collection of data elements of the same nature, and is a subset of the data.
    • Data Structure: is a collection of elements that have one or more specific relationships between each other.

4. Logical Structure of data (structure)

A collection of data elements that exist in one or more specific relationships with each other .

4.1. Element (node) type:
    • Basic data types: Integer, Real, Boolean ...
    • Composite data types: arrays, structs, classes
4.2. Relationship between nodes--structure

    • Collection: There is no other relationship between data elements except "belong to one set"
    • Linear structure: one to one, such as linear table, stack, queue
    • Tree structure: A pair of multiple, such as a tree
    • Graphic structure: multiple to multiple,
5. The physical structure of the data (storage structure) The logical structure of the data is represented and implemented in the computer. Contains the representation of the data element and the representation of the relationship.

Representation of a data element: A data element is typically represented by a bit string. Example, a eight-bit representation of a character, a 32-bit representation of an integer

Representation of relationships between data elements

    • Sequential storage structure: the logical relationship between nodes is represented by the adjacency relation of the storage unit. usually sequential storage structures are described by means of an array of languages .
    • Chained storage structure: does not require logically adjacent nodes to be physically adjacent, and the logical relationship between nodes is represented by additional pointer fields .
5.1. Method of order (sequential)
    • Storing data in a space-free storage area is called sequential storage
    • Sequential storage stores a set of nodes in sequential storage units adjacent to an address, and the logical successor between nodes is expressed by the natural order relationship of the storage unit.
    • Sequential storage provides a convenient way to access data nodes using integer encoding

5.2. How to link (linked)
    • With pointers, additional pointer fields in the storage structure of the nodes are called link methods . The logical successor of two nodes can be expressed by pointing the pointer
    • Any logical relationship R can also be expressed using this pointer address. The general practice is to divide the data node into two parts:
    1. Part of the data that holds the node itself, called the data field
    2. The other part holds a pointer, called a pointer field , that links to a subsequent node, to the start address of its storage unit. Links to multiple related nodes will form a link .

5.3. How to index (indexing)
    • Index method is a generalization of sequential storage method , and it also uses integer encoding to access data node location.
    • The index method is to construct a function y:z that maps the integer field Z to the storage address field d? D, map the integer index value of the node z∈z to the storage address of the node d∈d. It is called an index function and, generally speaking, it is not a simple linear function like an array.

5.4. Hashing (hashing) method
    • Hashing method is an extension and extension of index method
    • The index value is computed using a hash function (hash functions) , and then the pointer address of the node is calculated by the index table.
    • For arbitrary s∈s, the hash function h (s) =z,z∈z
6. Description of the algorithm

Algorithm features

The requirement of algorithm design and the standard of measuring algorithm

7. Summary

Data structure and algorithm notes (1) Basic concepts

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.