0% found this document useful (0 votes)
9 views5 pages

Understanding Arrays in Data Structures

The document discusses arrays as a non-primitive linear data structure. It defines an array as a fixed-size sequenced collection of variables of the same data type stored at contiguous memory locations. The document outlines some key properties of arrays including that the length is determined at creation and elements are stored consecutively in memory.

Uploaded by

Naira Elazab
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

Understanding Arrays in Data Structures

The document discusses arrays as a non-primitive linear data structure. It defines an array as a fixed-size sequenced collection of variables of the same data type stored at contiguous memory locations. The document outlines some key properties of arrays including that the length is determined at creation and elements are stored consecutively in memory.

Uploaded by

Naira Elazab
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Array

Array
 Data structure are normally divided into two categories:
 Primitive Data Structure
 Non-Primitive Data Structure
 Non-Primitive DS are divided into two categories:

Linear list
Non-Linear list
Array
 Array is under the branch of Non-Primitive linear list DS
 Definition of array : An array is a fixed-size sequenced collection of variables ,
of the same data type stored at contiguous memory locations , we can declare the
array in java as follow :
data_type array_name = new data_type [array_size];
example : int element = new int [5]
This implements the idea to store the various items to be accessed again or to be
retrieved .
 Proprieties of array :
 The length of the array is determined when the array is created, and cannot be
changed.
 The elements of array will always be stored in the consecutive (continues)
memory location.
 Array can always be read or written through loop.
Proprieties of array
 Array subscripts use zero-numbering
 the first element has subscript 0
 the second element has subscript 1
 the nth element has subscript n-1
 the last element has subscript length-1
 By knowing the address of the first item you can easily access all the items of an
array
Why we need array
 we need array to help us represent a large number of items using a single variable
which is much easier than define a large number of variables, so using the array
reduce the number of the variables.

How arrays work in data structure ?


 An array stores the variables at contiguous locations and gives
them a particular index. When someone wants to fetch the data,
the person uses this index.

You might also like