This article is about the word list as used in computer science. For other uses, see list (disambiguation).

In computer science, a list is an abstract concept denoting an ordered collection of fixed-length entities. In practice, lists are usually implemented either as arrays or linked lists of some sort. The use of the concept allows to treat them regardless of implementation. For this reason, lists have properties that arrays and linked lists share.

Informally, the term list is sometimes used synonymously with linked list. A sequence is another name, emphasizing the ordering and suggesting that it may not be a linked list.

The size and contents of lists may or may not vary at runtime, depending on implementations. Random access over lists also may or may not be possible, depending on implementations.

Sometimes equality of lists is defined simply in terms of object identity: two lists are equal if and only if they are the same object. In modern programming languages, equality of lists is normally defined in terms of structural equality of the corresponding entries, except that if the lists are typed, then the list types may also be relevant.

Lists may be typed. This implies that the entries in a list must have types that are compatible with the list's type. It is common that lists are typed when they are implemented using arrays.

In Lisp, lists are the fundamental data type and can represent both program code and data. In most dialects, the list of the first three prime numbers could be written as (list 2 3 5). In several dialects of Lisp, including Scheme, a list is collection of pairs, consisting of a value and a pointer to the next pair (or null value).

The standard way of implementing lists, originating with Lisp, is to have each element of the list contain both its value and a pointer indicating the location of the next element in the list. This results in either a linked list or a tree, depending on whether the list has nested sublists. Although LISP implementations (such as the LISP used for the Symbolics 3600) often use "compressed lists" which are arrays.

Some languages do not offer a list data structure, but offer the use of associative arrays or some kind of table to emulate lists. For example, Lua provides tables. Although Lua stores lists that have numerical indices as arrays internally, they still appear as hash tables.

Some languages may instead implement lists using other data structures, such as arrays. However, it is generally assumed that elements can be inserted into a list in constant time, while access of a random element in a list requires linear time; this is to be contrasted with an array (or vector), for which the time complexities are reversed.

Lists can be manipulated using iteration or recursion. The former is often preferred in non-tail-recursive languages, and languages in which recursion over lists is for some other reason uncomfortable. The latter is generally preferred in functional languages, since iteration is associated with arrays and often regarded as imperative.

Because in computing, lists are easier to realize than sets, an finite set in mathematical sense can be realized as a list with additional restrictions, that is, duplicate elements are disallowed and such that order is irrelevant. If the list is sorted, it speeds up determining if a given item is already in the set but in order to ensure the order, it requires more time to add new entry to the list.

See also

  • Multiset
  • Tuplebe:Сьпіс

da:Liste (datastruktur) de:Liste nl:Lijst pl:Lista sl:seznam fr:liste pt:Lista


"List"

 

Related News



Top Related Terms

1. craigs list
2. mailing list
3. elephant list
4. do not call list
5. business mailing list
6. live sex list
7. craig list
8. list management
9. christmas list
10. goat list
11. grown up christmas list
12. vecernji list
13. cat list
14. email list
15. strip club list
16. craigs list seattle
17. yahoo group list
18. craigs list los angeles
19. wish list
20. craigs list san diego
21. american express my wish list
22. proxy list
23. list longest
24. craigs list boston
25. schindlers list
26. cow list
27. grocery list
28. spyware list
29. craigs list portland
30. santas list
31. craigs list new york
32. sex offender list
33. call curtain eminem list track
34. craigs list chicago
35. santas naughty or nice list
36. movie list
37. naughty or nice list
38. radio station list
39. baby name list
40. search engine list
41. elijah list
42. craigs list ny
43. inurl list ref
44. craigs list nyc
45. hit list
46. business list
47. buddy list
48. book list
49. bull dog list
50. christmas song list
51. phone list
52. mailing list company
53. craigs list sacramento
54. grown up christmas list lyric
55. yu gi oh card list
56. christmas wish list
57. angies list
58. greigs list
59. fat list
60. black list
61. deans list
62. list broker
63. new york times best seller list
64. endangered species list
65. porn star list
66. atkins diet food list
67. gregs list
68. top ten list
69. friends list
70. custom friend list myspace
71. shopping list
72. area code list
73. craigs list la
74. to do list
75. music list
76. adjective list
77. emule server list
78. craigs list dc
79. best seller list
80. national no call list
81. craigs list denver
82. aol buddy list
83. price list
84. free mailing list
85. song list
86. craigs list austin
87. craigs list san francisco
88. biggie duets list track
89. female celebrity smoking list
90. j list