0% found this document useful (0 votes)
8 views15 pages

Arrays

A linear array is a collection of homogeneous data elements indexed by consecutive integers, stored in successive memory locations. The length of the array is determined by the upper and lower bounds of the index set. Operations on arrays include inserting and deleting elements at various positions.

Uploaded by

indiaurdutimes1
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)
8 views15 pages

Arrays

A linear array is a collection of homogeneous data elements indexed by consecutive integers, stored in successive memory locations. The length of the array is determined by the upper and lower bounds of the index set. Operations on arrays include inserting and deleting elements at various positions.

Uploaded by

indiaurdutimes1
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
You are on page 1/ 15

DATA

STRUCTURE
ARRAYS
LINEAR ARRAY
 A linear array is a list of a finite number
of n homogeneous data elements
( that is data elements of the same
type) such that
 – The elements are of the arrays are
referenced respectively by an index set
consisting of n consecutive numbers
 – The elements of the arrays are stored
respectively in successive memory
locations
LINEAR ARRAY
 The number n of elements is called the
length or size of the array.
 The index set consists of the integer 1,2,
…n
 Length or the number of data
elements of the array can be obtained
from the index set by
Length = UB – LB + 1 where UB is
the
largest index called the upper bound and
LB is the smallest index called the
lower
bound of the arrays
LINEAR ARRAY
 Element of an array A may be denoted
by
 – Subscript notation A1, A2, , …. , An
 – Parenthesis notation A(1), A(2), …. ,
A(n)
 – Bracket notation A[1], A[2], ….. ,
A[n]
 The number K in A[K] is called
subscript
or an index and A[K] is called a
subscripted variable
LINEAR ARRAY
REPRESENTATION OF
LINEAR ARRAY IN MEMORY
 Let LA be a linear array in the memory of the
computer
 LOC(LA[K]) = address of the elementLA[K] of
the array LA
 The element of LA are stored in the

successive memory cells


 Computer does not need to keep track of

the address of every element of LA, but


need to track only the address of the first
element of the array denoted by Base(LA)
called the base address of LA
 LOC(LA[K]) = Base(LA) + w(K – lower bound)

where w is the number of words per memory


cell of the array LA .
REPRESENTATION OF
LINEAR ARRAY IN MEMORY
OPERATIONS ON ARRAYS
OPERATIONS ON ARRAYS
 Inserting and Deleting
 Insertion: Adding an element

– Beginning
– Middle
– End
 Deletion: Removing an element

– Beginning
– Middle
– End
OPERATIONS ON ARRAYS
OPERATIONS ON ARRAYS
OPERATIONS ON ARRAYS
OPERATIONS ON ARRAYS
TWO DIMENSIONAL
ARRAY
TWO DIMENSIONAL
ARRAY

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy