数据结构是计算机中存储,组织数据的方式,精心选择的数据结构可以带来最优效率算法。
C++, Java, Python 等面向对象的编程语言可使用类完成这一功能。现代编程语言及其运行环境在标准库中都包含了多种数据结构,例如C++标准模版库中的容器,Java集合框架以及微软的.NET Framework.
数据结构意味着接口或封装:一个数据结构可被视为两个函数之间的接口,或者是由数据类型联合组成的存储内容的访问方法封装。
Usually, efficient data structures are key to designing efficient algorithms. Some formal design methods and programming languages emphasize data structures, rather than algorithms, as the key organizing factor in software design.
Data structures are generally based on the ability of a computer to fetch and store data at any place in its memory, specified by a pointer--a bit string, representing a memory address, that can be itself stored in memory and manipulated by the program. Thus, the array record data structures are based on computing the addresses of data items with arithmetic operations; while the linked data structures are based on storing addresses of data items within the structure itself. A data structure that is defined indirectly by the operations that may be performed on it, and the mathematical properties of those operations (including their space and time cost).
常见的数据结构:
数组 (Array)
A array is a number of elements in a specific order, typically all of the same type. Elements are accessed using an