0% found this document useful (0 votes)
17 views

Array

Uploaded by

soovamsg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Array

Uploaded by

soovamsg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CHAPTER - 2

ARRAY
Amay
Ara 7etiniion it's represeufation
A anuy 15 n0/eler set 0 hom0 qen eo us
ixed hUmbt oohjeets

One Dimuusieual Ar
Simplest olatu haut
Stouotwe mukes We ok
Copute dalolhess t locote its elem uts 1S e
Ome climemsional awnay. Numb oh mmoy octidas
is Sequeutiully ollloccteo tit One dim unsioual
clle Vecho
A VecteY Siz i sixed ell Hheprerequies
a i d numbe o mmery locatieS,_ Veetor A wI
Sub scsipt lode boune 0Me i s eprututul s

ho is He delades Hhe vst


Weya llecated t tefst eluntt
A
C wlavels are cllococte or td1)c-
euch elemeut eele AL
he Acddves o Ai is ideutikieal
a hoc(Ai) =lo t Cti-1)
Let's Consicde he move
eneyad case o
Y2pestuhing a Veoto A whese lowey boune er
it's suhscriptis given by Same vaicble b.
Hhut Cuse, Loceetio o_ALocCAi) Let CCi-b)

we Dimensional Avruy
W imsionalamuys are calltu table or mectix.
has
It two subsceipls Tn 9.D Ans el uts are
Shye Column by Colum i t iseLoOvM
eM
fAf.TRUfEsH ATCL (LDRP- ITR)
Column muOY Mtyix
elemeuts C h e gtoveel Vou by _w L it
is Called Vous major mtrix hiyst Subsrirt
denotes Mumbey _ok Vews lnel Seonol Subsipt
dnotes Hhe Mumbe o ColumS,

Col1
ba ba b
_Col2col3 cely
row 1 L111 C12[1,31| [11L19j IL3
row2 L2,11 LA23I,31 a,4J 211
C2,21L 2 )

Columy mayormatiX I'n,11 [n,2] [,3] [m


,11b
owMai Matrix
No o columns= M
nd-bt1

maov bueutyik LocAliJi)=Lotci-ba)* (ug-b,t1)


j-b1)
foy eX mple
hoc CAe3)= l t (0-(9) * C3-2 t1) tt3-2

Thre Dimenionul hr cousidey he St rine


of a olimemsieul l o y B Lshes pic
elemet is demutes by BI,,k1 Suhscaipts imits
a n l given by- isL 1j43 14k<4 The
Vo moy Ooley storuge epryemtutis a Has udny
wl be
BLLL BLLL2] BLLlA) BLL,LAJ BLI,2, BL,L,2J BLI, 2,3) BrL24]
BLSU BL2 BLL), BLlA,A] BL2,LL1 BT2121 BI3) Bt3A]
BL2RABrAA) B2,,) B2,3A1 BI?13,1 B[23,23 Br23, BT23,4
feof. TRUPESM PATEL CLDRP - ITF)
BL3,

BL313D B22,41

BI2,,3) Bt24

BL23,1L1
BI2,32J B,,

BT,2,1J BE)23.

B21

BT113, 3)
Bt2h
K
BLI323
BL
> B1,h1
BLI3)

BI,?,J
BL31

BL ,11
BLLL2)
BLL
piehria_represeutuhis_o t h 3pAnoy B,K
- fr«f. TAvPEsH f*TSL CLDRP-I1E)
14i2, 1<JL3, 1 k4
_Arry DeclwcutiM and nihiclisehid:
An ra is deelred
tupeuanme LSize];
type num utu tfe
Mame ldttiieh o aM y
A inalea shts. w t 0, means i size 3

t wil Veseve mem loccet _0,1 ene


9
Ispeebve av

exo nuple2 Jnt a[10],


Horay _willhave 10 mem sbjets hein
J

10 oliktenent Vcdus ntej _cdatu bype


Cuy be Shree.

at E 21
C list

These aalevesses_af He inalivldued


elmuds CUe culso Me as ivdexes
Subsxipts
nihalizaution 0f _arsS
fhe s c Com Sepwrnta
Cokstaut exprexsioMS euclesesi bueesE}.
he nih lizey s pveeesledy a oal Si C=)..
muncleteto ivitiulize all elts
pantinlly iniielizeel_elmets
iniHulizes Yeceive Hhe Vealue 00te
appropyile
type
eF. TH ?isM fATL CLDRP ITR)
Completily nhiliz 4D
numbeir 31-S,t,23

panhallyInitalize D Aeu
i t umber 1C31 =S1}
HL Aumber4|_Coutuns OVulue.

Cstom ni hul'zah
numher3L 31 Lo) S [11:7
He numbe 3l11_is
isimplicitly inihau'ze 0.

_No iuelex VeduL

Hee Compile nlfeads


MUbe e Vaues eueds to

ahwush Amu 1

chah Maond1L1= CL
ch name 2l1 Tan
cha ame 3 [41 Tan";

Mulh dimeusiouud Aas


mou eluss [2]I12
3129L30,311L12131h1120K
1, 30, t1,15,1E, o,12,,2s,1,11
3

RF. TruP1sy PaTLCLDR?-17)


Apthicutions oAuy
Symbel Munipulation
&. Spase Madriy.
Smbel manipulutim sinAruy
Aa CMbe wedL Vbus polynnial
Suen S Cloleliti Subtouetii,
euatio OpeLtions_

ivisio et
- Metiy epresetcuti o fonomia equhon

XYXY|xy3xy
X

EA Sx t3xy
3
2

Sparsee Mtviy
have many umbens_o Xo
mady ix
elumeuts i t i s Celles Sparse Mcutix.
s Cclles oleuse matrix.
Non-Spnse Natoiy

he MoM-ze'o elemels 0 OL Sparse mtriY


mub repeseteninto i n e At i You- maqay
OYeleh.

fpof TRUPESH fATEL (LDeP-ITP)


Consieer x size mutriy wth below elemts

O 0 0 1 0
6 0 t0 00 3
0 0 0 0

S 0

ti 4xs Mdrix

Ters 0 12 3 4 6
Pew 1 2 2 334
Column S _4 6 2 3

Value 6 1 3 4S
Liyeus epresotuti)ok_erbove metriy

o Constsuet Structu
4 Origin nuw and colus atench m Zeho eutries
a No o Yons Cnl columns M_Hne matyîx
We Mee h h e khide w, colymM,Vdue.

0
A
0 12 0

0 0 30 S

Hee 6 X7 4 elenetsCOnly 10 ane Mav


AL,3 G AC6,413
ALl) AT3,714 Al6,71-S
AL12 AT3,11o
ALh33 12

Pp»f.RF.TRupESH PATEL LDR?-1TP)


e dmensiM eprsuai

Row Calumu A
3

4
3
4 3 12
6 3

PepesetutidnoSpseMat
LinkesPepresedatin Metsix
Node. sruetuhe Ros ColumuVaue aiute To
Ment ode
1 3 6

1
6 | LL
upeo Pepresedoh o
Spnse Mutaly

RoF. TRUrEsH ATL LPRP-ITRP)

You might also like