Data structure
来源:互联网 发布:mac代理设置 编辑:程序博客网 时间:2024/05/08 06:35
In computer science, a data structure is a particular way of storing and organizingdata in a computer so that it can be used efficiently.[1][2]
Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks. For example,B-trees are particularly well-suited for implementation of databases, whilecompiler implementations usually usehash tables to look up identifiers.
Data structures are used in almost every program or software system. Data structures provide a means to manage huge amounts of data efficiently, such as largedatabases andinternet indexing services. Usually, efficient data structures are a key to designing efficientalgorithms. Some formal design methods and programming languages emphasize data structures, rather than algorithms, as the key organizing factor in software design.
Contents
- 1Overview
- 2Basic principles
- 3Language support
- 4See also
- 5References
- 6Further reading
- 7External links
Overview
- An array data structure stores a number of elements of the same type in a specific order. They are accessed using an integer to specify which element is required (although the elements may be of almost any type). Arrays may be fixed-length or expandable.
- Record (also called tuple or struct) Records are among the simplest data structures. A record is a value that contains other values, typically in fixed number and sequence and typically indexed by names. The elements of records are usually calledfields or members.
- A hash or dictionary ormap is a more flexible variation on a record, in which name-value pairs can be added and deleted freely.
- Union. A union type definition will specify which of a number of permitted primitive types may be stored in its instances, e.g. "float or long integer". Contrast with a record, which could be defined to contain a float and an integer; whereas, in a union, there is only one value at a time.
- A tagged union (also called avariant, variant record, discriminated union, or disjoint union) contains an additional field indicating its current type, for enhanced type safety.
- A set is an abstract data structure that can store specific values, without any particularorder, and no repeated values. Values themselves are not retrieved from sets, rather one tests a value for membership to obtain a boolean "in" or "not in".
- An object contains a number of data fields, like a record, and also a number of program code fragments for accessing or modifying them. Data structures not containing code, like those above, are calledplain old data structure.
Many others are possible, but they tend to be further variations and compounds of the above.
Basic principles
Data structures are generally based on the ability of a computer to fetch and store data at any place in its memory, specified by an address—a bit string that can be itself stored in memory and manipulated by the program. Thus therecord and array data structures are based on computing the addresses of data items witharithmetic operations; while the linked data structures are based on storing addresses of data items within the structure itself. Many data structures use both principles, sometimes combined in non-trivial ways (as inXOR linking)
The implementation of a data structure usually requires writing a set of procedures that create and manipulate instances of that structure. The efficiency of a data structure cannot be analyzed separately from those operations. This observation motivates the theoretical concept of anabstract data type, 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).
Language support
Most assembly languages and some low-level languages, such as BCPL(Basic Combined Programming Language), lack support for data structures. Manyhigh-level programming languages, and some higher-level assembly languages, such asMASM, on the other hand, have special syntax or other built-in support for certain data structures, such as vectors (one-dimensionalarrays) in theC language or multi-dimensional arrays in Pascal.
Most programming languages feature some sorts of library mechanism that allows data structure implementations to be reused by different programs. Modern languages usually come with standard libraries that implement the most common data structures. Examples are the C++ Standard Template Library, the Java Collections Framework, and Microsoft's .NET Framework.
Modern languages also generally support modular programming, the separation between the interface of a library module and its implementation. Some provide opaque data types that allow clients to hide implementation details. Object-oriented programming languages, such as C++, Java and .NET Framework use classes for this purpose.
Many known data structures have concurrent versions that allow multiple computing threads to access the data structure simultaneously.
See also
Book: Data structuresWikipedia books are collections of articles that can be downloaded or ordered in print.- List of data structures
- Plain old data structure
- Concurrent data structure
- Data model
- Dynamization
- Linked data structure
- Persistent data structure
References
- ^Paul E. Black (ed.), entry for data structure inDictionary of Algorithms and Data Structures. U.S.National Institute of Standards and Technology. 15 December 2004. Online version Accessed May 21, 2009.
- ^Entry data structure in the Encyclopædia Britannica (2009) Online entry accessed on May 21, 2009.
Further reading
- Peter Brass, Advanced Data Structures, Cambridge University Press, 2008.
- Donald Knuth,The Art of Computer Programming, vol. 1.Addison-Wesley, 3rd edition, 1997.
- Dinesh Mehta and Sartaj Sahni Handbook of Data Structures and Applications, Chapman and Hall/CRC Press, 2007.
- Niklaus Wirth,Algorithms and Data Structures, Prentice Hall, 1985.
External links
Find more about Data structure on Wikipedia'ssister projects:Definitions and translations from WiktionaryImages and media from CommonsLearning resources from WikiversityQuotations from WikiquoteSource texts from WikisourceTextbooks from Wikibooks- UC Berkeley video course on data structures
- Descriptions from theDictionary of Algorithms and Data Structures
- CSE.unr.edu
- Data structures course with animations
- Data structure tutorials with animations
- An Examination of Data Structures from .NET perspective
- Schaffer, C.Data Structures and Algorithm Analysis
- Data Structure
- Data structure
- Data Structure
- Data structure
- Data structure
- data structure
- Data Structure
- Data structure
- Data Structure
- Data Structure
- Data Structure
- Data Structure
- Data structure alignmentData structure alignment
- Finish Data Structure Examination
- 【OPENGL】DEVMODE data structure
- Critical Data Structure -- sk_buff
- Data Structure数据结构
- Data Structure: Tree
- shell kill 进程树
- C/C++宏定义的可变参数(VC6不支持可变参数宏)
- ubuntu 10.04(64位)下搭建android2.3/android4.2/4.1/4.0开发环境
- Oracle 字符集的查看和修改
- Visual Studio 2010 下 Boost.Regex 库的使用笔记
- Data structure
- 现实迷途 第二十七章 深情表白
- call 不可以使用在plsql中,只能在sql*plus中使用。
- Yii 显示错误信息(Fatal Error,Warning)在页面上
- Asp.net Jquery Ajax 实例
- FPGA DS18B20
- Tomcat+花生壳配置web项目实现外网访问
- 弹出层实现
- 程序员必知8大排序3大查找