Python data structure

Source: Internet
Author: User

At the computer hardware level, all data that is stored and processed is eventually encoded as binary code

Collection structure: There is no explicit relationship between its elements, that is, the relationship R is an empty set, and such a data structure is a collection of elements.
Just wrap a set of data elements as a whole. This is the simplest type of data structure.

Sequence structure: It can also be called linear structure, there is a definite relationship between the data elements, there are successive elements except the last one.

Hierarchies: Data elements belong to different levels, and an upper element can be associated with one or more underlying elements.
Tree structure: The simplest is the tree relationship, only one root the rest of the elements are directly or indirectly related to the underlying relationship, only one and only one upper element is connected to it.
The structure of a group: there can be arbitrarily complex interactions between elements and elements.

The use of a data structure in a program requires that the structure be mapped to the basic data mechanism provided by the programming language, or the data structure required by the programming language's data mechanism. This mapping becomes the physical implementation of the data structure.
Simply put, data structures each language has a different structure, and the data structure is equivalent to a class instantiation of different objects, such as Python java.
Data structures that support element storage and access are called containers.
Functional data structures designed to include stacks, queues, priority queues, dictionaries, and more

When the computer reads the data, it reads the memory directly, if the data is saved on the hard disk (external memory), it should be copied from the hard disk to the memory and then read.
A unit can hold data of one byte (8-bit binary code), and a 64-bit computer can read 8 bytes of data at a time
The operation to access memory is also known as I/O.


When accessing composite objects such as lists, tuples, and multiple data, multiple yuan is stored in a contiguous area of memory, and the ordinal number of each element is called the index subscript.

Continuous structure or link structure is the basis of all data structure construction
The data in the block points to the association relationship, which is one-way, also known as a link or reference.
A variable is an abstraction of memory address, a Python variable is an object, and the Python implementation is called the argument of the variable, for example, A=1,a points to 1, if B is also equal to 1, then B's ID value and a are the same, all point to the same memory address.
It is called value semantics in the store where the value exists directly.

Immutable objects are created and then performed other than read to change the memory address
mutable objects: Once created, you can change the memory address.

Python data structure

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.