0 ratings0% found this document useful (0 votes) 58 views10 pagesDSA Unit 1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
LJ Note Junction
Best Note Provider
Note By: Roshan BiStUnit=1
Introduction ho Date Structwes dA gorithms:
4, @ Deda. Types:
The “cada, dupe of a vale ova variable tan abhrbule
gama
es and e Storage casstficadims ike 4 5; flea
pond Naies sce s , “havscleve etc, Fadv variable ered
associated, cel Mise, Each data, dif vans
Mewury and ust some vpetie Hedi ene
performe over gt, i
@ Baste Dale ypes> the dlodar--b pes had: are pre-deftnae|
ae ane Tamediagely sails to users by Comptlen.
Woh wd tc dabe Ss
baste FT) oan iss” PH Sve Be
pad His a date Awe used to stove values,
oS dhe fling AO sokne oe bal Ge ctoe
qin this all Ape chen 44 can nol store floadi
Numbers. 14 wt minate or escape, numbers
dectmat pome and will only store frachenal value .
tt) Chavackn Tf stores & Single character. and requires
a7 omc nk gut
aingl ble of memary in almost. all compilers.
Wd float > 6 48 used to stove decimal numbers with
angie precigim. rf takes t-byle ‘remoys
fvy Doble > 43 uged fo alle olectral numbers with,
elwale precision. 1 takes 8 byle rmamory spaceEEE
| defined
® User-defined daba Lypes > = the data ie Hel pe 3 ‘i
the user. mr the prograun ane call is
Hype or USer- ~alefned data. pe Fallosing we some of
user-defined olata Lypes:
Class-> the uso. defined date, type that holds cata.
Yremnbers and menaer fyrctins ts ealtet ¢ class. A
ce class can be access and used by © pang check
of that class.
thSirucdures A struckne #8 a user defined data Sype sn Cfe**
A stuchue creates a dada e that can be used to
an? stems of possttg different types dnt a ee
th Union > Union 48. user-defined fale Ape stratler fo
structwe. Dr union all menbas Shore fhe same
Yremoyt Jocallton.
1) Fnumenabion- Enumeration» Enurnerachnn, (or enw) #54, user defined
mm Co Tt yg vaalnpy used tp asstayr names fo
constants, the namég - iar” | gag
> Coead, and. mmababain. “ef
sah Stalin, del
a, SATU a vs. e "9
data, 1. such. a woay Hod nce otelg 4 orl reg
these data. tm de effective wage D foatn “teens 48 abou
rendering cede elements nt, sl ladionshi
organiation and sboage, " Satta me rela ip. for etl,
‘Bot ample heb we hae same claba, hich h has,
shudends name “Ramesh? and age 24, Hero “Ramesh” of
Eheing dade Safe ond 2 48 of Ink ate, Ape, We car
nee ne veal a retard like“ Slidenbis ecard, whieh
an i4.N
“Shdeebs yecred ing, mee a ad he file a soeTn. simple language Jala sfrickues are -chuchues pregrenmec
i alee, "Teed con Phat various, opeatin can be performed
on -id aye represents the knowledge ofdala 40 be,
organized ‘mernary t should, be ll and snplenedel
dn such a Hhat 3b Sed the 1 d
efi “ay ah reduces Complexthy O74 fnoreases
@ Uses, f dada, stuck
Pobake sdvuchue tevaed to reduce. mpl of programs
TA Yt 48 used db tncrease. efftdency of programms.
T) Data stuchues are use] as a, Stk for eng
ond storing Gp formation re veri
™ mh preven ae collision hy oy am ne
> Tt id, to
Tiel to srw te late a
3. Abstract lado. Mpes (AIT) +
Det» Abstract "data Lupe (Ao) 48 av Sipe or a Class for objecks
“ne stleston 48 deffned, by a seb of value and. a, set
oO
a. Tt does ates how dada. will be organiced
Be cag okt i at fn
@bses: wed the 1
ADTs m f
a7 ie tnt od soll dere " ets Salgoithns,
1 He proutles concep for late, ro and clad, bili
@ Advas enefis of using ADT
>Modulari,
1) Pease Sp lftcatbions.
uP Information dud Y
1s Stmplle
yp Tnbegei -
vip Duplementation andeperndence .A, Concept namic. mem allocation: i
Th allocadion hab we do dun
Cormgtle drone a9, dale wel, allocation, Tf the wen
allocedion as, lave. during yundine 13 callec dynamic
‘mom allocadion, In Uetattc mom
allo chthion
the wremeny used. ‘oy the, progr 8 ead 4G we tale
rot decreade or inaease the sizeof memay during, H
exeurion of program: Th wneny applications tt 3 vot
possthle do predted shoo much ‘mem hew
Fhe praram ak wn timeenno anthis cthuaction
follosing Bo Spe ot problems malt OCCUR.
YU Bre nurbore? values to be edoveel te leas dan the sioe of
Bray dhen thee wellbe the westage Ff rnexnory.
Phe a ees on des my
TO overcome theee. problems we should be
able Js allocate wenosy al rundime.. the, recess of
cUlecating Ynernant at “Lthe cline of exearhion 13 called
Aram rrerneny allocation the allocation and release of
Abs spree sree fan be clome with the help of some. ;
builllem-fincions vhese pont eS are in alloech an
Cd ee files, r ‘t int ined
finders slouy Bun J) oland nite Mn al ‘
ey alloation berapae le can cease CA oc
allocated menoygt orp) teal paticlers. aly
@ Some butlhein UBC Indynamie ynen allocations
P walloc() >this furchion 48 usedl do allocate” vrei
dynamically .
Sita. : porter_variable = (ede type?) malloc (speatfied ste);calle dbo allocate rnultiple blocks
Fe pn eal la xc
hoo C s. 3 loc() tales
Mnljone eed eit Cat tet bs
The’ firsd Lumet? S eck} ber hlecks and Lhe
Send on cifies af ie eh eh
Fat example; pér=(nt*) calle ea steeaf{ind));
The other difference belseen calloc() and valloc (4s thal
= ene aifleer by malloc () cons gee Palos wee
he remibiy allocated by callecl ) 43 tnthiMreed Lo zero,
tt) vealloc()— The furchion realloc()
‘nares block, 7 allers Bie at Pat ee eit ou
losing Ue eld clata.. this ts brown as vg ccatton Preemay.
_ 5 furchin dakes Avo ayguovents fren
Povees ae the block of ven that was reviousl
Menkes, by yall ss
sete aalleo ocala stn on [etherigh sie
ar evanple: pir = (inl *) realloc (ptr neste);
5. Tntroduchlon to Alportthras:
Doefmibion> A process or set af vules de be fellooed sm cxlullions
ov other, preblem—s.lving operations hyo connpulen 8
called aldot Yam,
@.Whab 15 gerd, algertfhrn?
Ans; A slyodlh ty od goed. af at contains following characlaishis:
D An ttm should Inowve Zacted anos,
ae An al Cidhm snuld produce aesnedl otha a
‘ lo steps man algortthm shuld. be.
Besson > hed Eide, “0
Uniqueness > The results of each skip ave uniquely defined. and.
F only depend om ‘input . v
Eels» The abjoithon shllasAep afl. exeubig filenacfskps.
Effective > Rach sep da the abgertthm should “be effeclve .
Re ice ec ad@. diferent shruchwes used fn algerthyns:
cvtthyn fo seardz an tem tradable
i\Seardh > Ay
tt) Sort Agen thra do sock thems ma cotain order
mInsexk—> Alget tna fo onset tlm ma dada -ctrichue.
nm Update pepe de update an existing shen gn a
» melele 2 ‘agente a> “clelele an existing dom from a.
colada, stuchue,
6. Asumedol teckt A ctions:
Ayeridhi Jlextdy—> Suppose. % 4g arr alyortthyn and 48
@. Aljeridarn Complersidy—> 9 Stee” way thet
a a of Le ut ts ste ‘hers dint decide ae epfictony of X
$7 The fader Time 1, measwid by count ing pon sel,
uch ag companisiers indie. socdin 1g apes
operat ims Ss
pSpace father>,Space 48 measure ceunsieg Phere
Smamory| Space: requirta by Lhe Kgertthra,
the complerity fan Hua fln) gives
Hime and, Jor Lhe “shege |
ee
the alps vn ine jar hn 08 Bed ane mp
# DSpace ext
of ar alootthm veprezents Phe amourd.
Spowe comps
of mamay Space veguredl by fhe algeithrn. . in dhe 4 ogee.
on
A
The. spose’ equired orithya 7% het i ae
grhered me ae
BA fired: ae tab t a space or shore confati
that ane. din dort of the size of Hoo.
dota avd voriahles , th
problem. for 2 vegnple, ) Simple, Voniahiee and consdindes used,
pro am size
3 A “variable wali 13a Aspmpodadte analyets and esppapohatc nodations : .
“Asympctalt c analysts sof an alycrtbo refers alefning the
nobhemetical fravnins of 1h wn dime ere nce..Ugi
Beiprplals slyeslnscan wpa lice hee 4.
“ovenmge. CHB NOW WorSh Care Scenario ofa 7
tha Hire required, (py am alert ne. falls wrlo, parte. teal
PBeed caze—> Minimum me reputed, sor Pram “seecudion,
ar) Average ax> Avensae ima required for p exeecuthon
i
1m Wors# case —> Meaxiaurn ive rethed fir pngraum execution,@ As labins + used Srbic nobocions |
“ong are the. Grmronly
te cable Ue runni tone woe an abystthm.
Ok naked, 0
a Notation , 2
‘Sy Notation, @
Big Oh olan clenabed by 0)!
By O vofadim 43 a rathernadical viedacion Had,
deserthes Y the limiting behavinws of a funchion wher the
aogumodt: tends apoands a. pardteulan value or tnfially.
Me Computer. aon a 0 nobachion £8 Use] to
clacet}y algerttins according ty hows thoy “vig ne
oF Space genes requhement gras as the
re oa al rare) shen bg 0 aedlfiats
° reBS B henune] on “the arffeunce by
an antthmedie nl rockin and a bebler “ch pnd
When we shove oa fe upper bound ther we
vodation, (at fod sage ee funckions ‘Row 8 bel a he s4p
seh of Integers Shen anediont Ho) 4 said tobe by Oh ef a(x),
#469=0 (aed fond Cay Shoe exh
cbeo post =. iY, ‘o and 2x, such Had.
This above relation ghasg Yas le) #8 an ao >= % fx)e= “Cee.
* 99 beund f )
fe ge
a
—_7?
Some pro be Fig. Geometric more, on pci of Oi Oh nb
BRanatdivid ~ opmntiee = O hee
a sin W528 Be Che D then, $6) = 0 (hes)
Trans Wel > fa <)) afan: =ampli Bnd by ch of given forchion. fQ)2 30? 4+ 4n4+F
Solution
ve hare. f(r) S30 4+4n4¢h 2a Bit 4 dnt # Le 14%
f(r) 2= ave
Wheres cade arc gla) = av thus,
$od= 0 (god)= 06%).
You might also like
C# Programming: Arithmetic, Swapping, Data Types, Quadratic Roots, Palindrome, Even/Odd Numbers, Leap Year, Floyd's Triangle, Stopwatch
C# Programming: Arithmetic, Swapping, Data Types, Quadratic Roots, Palindrome, Even/Odd Numbers, Leap Year, Floyd's Triangle, Stopwatch
56 pages