Encyclopedia > List

  Article Content

List

In computer science, a list is a kind of data structure.

By definition, a list is a finite set of entries with a certain order. The entries in the list, depending on the language, may be constrained to the same type, or may be of mixed types. An array is a related data structure that also stores its entries sequentially. However, the items in an array usually must be of the same type. Nearly all kinds of tree structures can also be stored as lists.

In Lisp, lists are the fundamental data type, which can represent either program code or data. Some languages do not offer a list data structure, but offer the use of associated lists or some kind of table to emulate lists.

In Ruby or Prolog lists can be written like:

[1,2,4.5,"hello",[1,2,3]]

In Java, list is an interface in its standard library. C++ provides general list facilities in its Standard Template Library (STL).

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 or not. Some languages may instead implement lists using other data structures, such as arrays.

The manipulation of lists can be done using iterations or a recursive algorithm.


A list is also a meaningful collection of ordered entries. See List of reference tables.



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
David McReynolds

... Paul Buhle: Nonviolent Activist. 1999, May 01 - "Annual Dinner And Peace Award Ceremony: A Celebration Of David McReynolds" - Pamphlet: War Resisters League. ...

 
 
 
This page was created in 43.4 ms