Data structure

来源:互联网 发布:mac代理设置 编辑:程序博客网 时间:2024/05/08 06:35
From Wikipedia, the free encyclopedia
Jump to: navigation,search
a hash table

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

  1. ^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.
  2. ^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:Search WiktionaryDefinitions 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
http://en.wikipedia.org/wiki/Data_structure
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 打黑工被发现怎么办 几年前被犬咬没打针怎么办 对狂犬疫苗过敏怎么办 想去墨尔本留学怎么办 大学没交学费会怎么办 交学费收据丢了怎么办 上海浦东金科苑幼儿园统筹怎么办 红酒瓶塞掉了怎么办 红酒瓶塞丢了怎么办 收入证明没有公章怎么办 父母没工作怎么办签证 在温哥华怎么办新西兰签证 上班第一天无聊怎么办 上班紧张不自信怎么办 销售到了30岁怎么办 转行会计没经验怎么办 澳洲coe被取消怎么办 父母不同意嫁远怎么办 家人不同意我们在一起怎么办 语言课申请不到怎么办 墨尔本大学均分不够怎么办 去澳洲旅游签证怎么办 换新护照澳大利亚签证怎么办 大学错过交学费日期怎么办 留学加拿大申请工签被拒怎么办 英国大学挂科怎么办 小孩子学不进去怎么办 大学生学不进去怎么办 高考没考上本科怎么办 想读书家里没钱怎么办 考上大学没钱上怎么办 儿子没考上大学怎么办 后悔没上大学怎么办 把学费花了怎么办 临床预科挂科怎么办 补录了预科怎么办 美国预科没过怎么办 出国留学报到证怎么办 本科绩点2.93怎么办 在美国被抢劫怎么办 去美国留学费用怎么办