0% found this document useful (0 votes)
4 views7 pages

Data Structures

The document discusses various concepts related to data structures, including memory addressing for arrays in both row-major and column-major order, and the asymptotic notations used to analyze algorithm complexity. It explains Big O, Omega, and Theta notations, providing insights into upper and lower bounds for algorithm performance. Additionally, it outlines the process of calculating addresses in multi-dimensional arrays and the implications of time and space complexity in algorithm design.

Uploaded by

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

Data Structures

The document discusses various concepts related to data structures, including memory addressing for arrays in both row-major and column-major order, and the asymptotic notations used to analyze algorithm complexity. It explains Big O, Omega, and Theta notations, providing insights into upper and lower bounds for algorithm performance. Additionally, it outlines the process of calculating addresses in multi-dimensional arrays and the implications of time and space complexity in algorithm design.

Uploaded by

pranjul2103gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ATA STRUCTURES

- Rish kesah
(Kes-30l)
AA6iqnuUnt-1 CSAIS
ol21520146

1 u A be dimeN tonal arou deelared ad tollouwt


a two
AsuMin that each
A aYYd oJtIs inteqer
Fored
integaytak NUMOTY locahons the arT OL A
in ro MajoY Oroler and the firtt element the ory
is stored at lotaHon 100, what t4 tht address he
elumont ALitj?
iven
AaTTOuy 03LI 51
t
Sqte address= 100
Size e t h LM OYu
LR
LC =

Addrest o th elument ALilt


Base Address +((i-LR)xn +Ci-Le)) x size.
1D0+(Ci-I) x25+ j-1)) x
= 100 t(si -5 t - m mo. dcoluMN
100 +(5itj -26)2
00 + 50i t - 52
ug t 50 t
AymoHe Notauhons 9 Orite a
h e u do you by Muon
Gd a) LO
thuta 'and Gig ONLqa
nott on Biq 6h, Biq
hsyMptoHo No tahong
Notaiont are the Mahemaheal noteuhons
AsymbloHo
wed to descrtbe the runnnq
tL n alqorith m.
ohen the inpu tun d to uotr o
a bar Heul ar valu
o aJiuHnq vauul
Theye aTe NUnly three aymp ho H motahoA

1xBiq Oh motahon
+ rerelentt thtpher bound the ununq M
an alqoYIth M.thus, it qves the orst~ caje tOMblexty
a n al gouthM

+Cn) fn)0 g(n)

0 n) tt) there exist posiHve cons taunt Cand


m6uth that
0eF(m) cqtn)
for al MMo
.3OMe a Motahon ( - Notahon) :

OMega Noteuh on TebreA nts h lower bound Hhe


Tunni ng HMe om aqovi thM Thus, i providel
th bet COMe OMlexi n
aleorifhM

ro Actof 3tot Cm)

aund
Dqtn) f(n) there exist posIti ve tonu tants
no Suth that osCqn)ttn)
Notahon -Notahon)
3 The ta
Theta Notahon encloses tht bove und
unchon roM
uber ond th lower
belouo. Sintt it Yepresents he

bound the unnl ng HM o un lqoTithM, i t


wedl toY analytin th avergo cae toMlexiy
a n alovitM

ACn) Cn) qtn)


C gn)

here exis poihve tonstonts C


Otn) ftn)
ancl suth that oe C, q(n) f(n)e g n)
for a l neMo

b) 0hat i th tiML oMGlui y t ollowinc d e


oid un (int n)
int i,ik, count=
for(i M/ 1Fn itt)
torCi= j+n/h <=n jtt)
torCk =1; ke=m, = e*2)
Countt+:
Setent requtn e Exe cuhon Conpuhahon
TiL TiL
indik, tount=o
tori- 1Em Itt)

forli-jD,<=njtt)
fow(kl k cen, E=E',) toq n log m tu

TIL toMplexi ty x mxm x loqn

mToq
o Cntoqn)
3 0) Fined the address in both Rouo-Majov nd tolumn Hajor
othe 8861951 for the given avva 8dta:][3:3] a:7JC91
0hun the baue address is 7000 and is olout
e
Sale Acddve-1000
SIRe
e0th NEMOTY 4 byt fd
b)Considuy 0KS 2D aTTay 'Marks Baue addresS=1000
and sizt uMOn 2, Cal eulatt addrecs uMent
Hayk ti9It4], in row Ma0Y Order and eoluMn Major
orcley
Gven,
NaYks aTT o]U5]
S1
Baule oddrets 1o00

RbuO MOY OTdey

Addrest ement arkS


Li9J4
Daue addreu +
((i-LR) *n +ti-L))xsize
(13-1) x5 +(u-1))x2
10O0 +

1obo t(17x5) t3)2


=

ODD+95 +3) 2
1000t88X2
-1000+116
= 1176

ColuMn Haor Order


Address element Marks L18J 41
Sale address +(li-Lc) M+(1-LR) )x size
1000 + (-1)xA0+ (It-1))x
1boD
(3x20 + 11)x2
10DD t 60+11)2

Do0+17x2
1000 154
1154
0-a)hat is t Spavte Matwix suggoyt a abau iti e
unet
reruenahon o sþarse Matvix
objeot uadi MTOwt and
m
AMaix i a-D data
the
eoluMnS, thereore havin total MXn yaluu. t M Ost
callud
oluMents t h Mavix i OV aull, then tt
Sharte Noltvx
tha
here are to0 aus to reprJent spaTte MaVIX
ave Jus ed oul ollouas
*ATay rereAentuhon
unked List represontaion

o. Hou do you n d th toblexIfy an algorithM


oahon betuoe TIML Ond 8pa eonblerittes
Ohnt i the
oan alqorithM? Jut 20'Y 0 er i t h an exaple
n
the ou thetent ouys o nd
thi toMplexi fy
alqovi t M ae
or pa
and uded hu oun
tuL aMount o H i
to pYOCLU n inbu oa sheciicslze
algorithM tompuuty, OT siMpy
known al th tomputato nal
coNplexit y o a n algonthM
wied to calcuatt
MotaHons are
hsymb o HC
Hu cOplexlty
aleori HhM
to how uch MDYy
tOMpleiyeS
trM sba o nu Thi
cOputy
TUn
equre fo i
thL proqraM
lg0rithM H u nbui
puityty
an
aulor otHedHng a o Teultiti o uncHon o1
th sie oinput
the Input síu 'n

Let'l say e are tal ketl toith duferininq 0hutheY


on tntee x A pTelent n the arTyA
t h e enttra arYuy A can be FraniveYteod ad a sIMbu
sol uon to thit ies ro SeL if eluMent ia
£ach oberatbn thoWd +ake c dock
equal ho
Thi valut duerned ho MOy nes o cocl d
Tun Analuinq oan alqorithM, w i l priMariy take
th 00YIt COAe
tht tcenarIO inho actbuut, oith is fhu
cale tohin A cbsent froM aTTyA
fThL 100TC cOLe, to hure n i t h ungth oth avYCUy
t condli Hon wIAeXxe cuttm HA
thorePove, m thme oott coue, Hhe return stautt MLnt O
take,c secondl and t h it conditHon oil oke m X
Secondl Fo tOlplufe
Hent to tal running HU 01be (mxcte)
S T h an alqovithM to add tuwo poy nomial
nked Ut
Inur: polyno mi al pl and pt rebreente d a
inked JUt
Alqo
Steb Loob aroun d al valuu Jinked J t
and toUouo se n d 3
Steb I the vauul o Mode's
reauttr coby thlt mocl toexbonent 1
q reaute reult mod
and huacd
FouoaTed tL nit modu.
Ste 8 3 the valul oh both moclA exponen ia
SaML add tu coeHdentc and u n CDby
thu ad did vaUl olth modt to u TeAult.
Ste 4 Print t Tesultant mod

6 0het is MLant by a tireulay linked Utt Ori th


wntho na o pertoTM t h ollowlnq oeroHons in a
oulolyJinked itt
T urud av inked Jitt i a unked Ut ohiwe al modu
aYO onmecttd ooYM oiTdav
o TlPe n c r u a r imted
Jinto
Jitt, th t nodl cund h lAt mo I ton nectd
to eath othey 0huth oTMA 0 urtuuThUre i no
NULL t Th nd.

You might also like