Category: 

What Is an Array Data Structure?

Article Details
  • Written By: Eugene P.
  • Edited By: Angela B.
  • Last Modified Date: 22 August 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Roughly one-fifth of the world's stock of gold - worth over $200 billion USD - is stored under the streets of London.  more...

September 30 ,  1949 :  The Berlin Air Lift ended.  more...

An array data structure is a method of storing similar data types in a linear sequence.‭ ‬This linear sequence allows very fast and efficient access to any part of the array.‭ ‬Each piece of data in an array is located at a numbered position called an index.‭ ‬The actual data located at a particular index is called an element.‭ Arrays are widely used in most computer programming languages and are the basis for many other types of data structures.

One of the primary features of an array data structure is the way it is stored in‭ ‬memory.‭ ‬In most instances,‭ ‬arrays are‭ ‬stored in a linear sequence.‭ ‬Other data structures, such as linked lists, can have each element stored at any random point in memory scattered across the entire area of available space.‭ ‬An array is stored in sequence,‭ ‬so a number of efficient operations can be performed to quickly find the address of an index in memory and retrieve the data there.

There are different ways to declare an array data structure.‭ ‬The simplest form is a one-dimensional array, which begins at index zero‭ ‬and can have as many indices as necessary.‭ ‬A two-dimensional array has two‭ ‬indices when referenced,‭ ‬similar to the width and height‭ ‬used to assemble coordinates‭ ‬on a‭ ‬grid.‭ ‬Multi-dimensional arrays can have three or more indices into the array.‭ ‬Although the array is being accessed with more than one index reference,‭ ‬the data are still stored linearly in memory.

Ad

Arrays are different from other data structures, such as linked lists.‭ ‬A linked list is a dynamic structure that can grow and shrink as the program is running.‭ ‬For the most part,‭ ‬arrays are static and their size cannot be changed during execution.‭ ‬This means an array limits the amount of elements that can‭ ‬be stored during runtime.‭ ‬Conversely,‭ ‬an array allows completely random access to the elements that it contains,‭ ‬unlike a linked list‭ ‬that‭ ‬must be traversed in sequence to reach the elements in the middle and end.

The speed of an array data structure makes it perfectly suited for use in other,‭ ‬more complex data types, such as hash tables.‭ ‬The predictability of the memory addresses of the elements also can be used to implement very fast array splicing algorithms that can move data quickly.‭ ‬This is particularly useful for sorting operations such as bubble sorts‭ ‬that are perfectly suited for use with arrays.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}