0 ratings 0% found this document useful (0 votes) 5 views 7 pages DAA Assignment
The document appears to be an assignment related to the design and analysis of algorithms, specifically focusing on Huffman coding and min-heaps. It includes code snippets and structures for implementing Huffman trees and heap operations. The content suggests a programming context, likely for a computer science course.
AI-enhanced title and description
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
Go to previous items Go to next items
Save DAA-Assignment For Later
@
Nome '- Bidaya Kumar mod
Reg. NO. 1- 23012IR45A
Breanch :- CSE CAIML)
section i- A
Subiect :- Design And Anarysis OF Algorcithms,
Assignment = 4
feincivde 4sidio “hy
Hinciude 2StdAlb sh?
# include CsHaN) .h)
# gerine MAX_TREE_HT 1000
Struct Horemannode @
Chore data;
Unsigned Fret,
Struct WarrManNade * AeFL , * rcignt;
Src winheo? &
unsigned size 3
unsigned Copaciey 5
SHUUCE HUFFManNade * * area
4)
SHUG HOFFMANNOde* — newNoeCChare Jata, UNsignes Frey)
SHUACL HOFAMANNaJe ® remP= (SHC, ena
MOC Sizeok (Steuct Hesteeanin)
tem? lert = $eMP Drlidnd = NULL;
+emP-) data = datay
femp-) Fret = Frey
Refonn $eMP )ee. eee er ne oe ee
Syracl MINKEOR * Create Min Hear (unsigned Capacity) §
Strock MINHeoP minHeat = (SHWCL pinHeaP*) manioc.
CsizeoF (Struct min teaP)) ;
MinHee? - size = 0;
minheor > caracity - coracty +
minHeor > growy = (Siucl’ Haremennode * *) Masioc
Crintear 2 Caraciy * sizeok (SHeuCE putemannajes))-
metarch minHear 5 2
y
oid SoFminerPNoae (SHeAcE HUPMannee %
SHwCL Hateman Node ** 4)
<
SHWCL yurpmannode * bemP= * A)
a= *b}
1 2 LEMP,
he Sey
3
Vold mintesPiey( Steel innear™ minvear int ide) s
jn} smouesi = idx)
int AGE = 2° jax thy
fap ran 248 sax yo
y
IF (Aer) 4 minHea? size 2 g munHeat.y annay racer] Sprey
CminheaP-) annay Csmanest] 3 Arted)
Smolest+ = AeFr!,
jf Ch) LminHear -) si )
Bie ? Size RR mintear.) annus CragH4) p09
< op 2 Muu smajes} a reg)
Smoles} = ruigns)
JE Csmanes) }= idx) 2
Sarin earNodeC & minHear) away rs masess J] , & minheeP?
minieorif'd CMnHeaP , Smasest 27 QreuagCidx 7
met,Q.
Spuch — HURFMONNOde ® EXEMACLMIN (Struct MinHes?®
minieaP ) §
Speech yureMonnade Kopp - Mina? array Lol,
mibnes? 9 greneg Co] = minkear — array Poinnear-ssiey}
~-rainies? 2 size;
Minneariey CminteaP 0),
retann jemPy
pi) inseraminveaP CSHued Minneap K minibar, Siuact
pacemannase * node) §
peminner? size,
In} i = minkear 2 size -1y
cohine CIRR Moe DAMES Crintea? 2 MUAT C1) Bere)
Minneap-) arcugci) - minnear 2 areas Tei-1) /2;
=Ci-))/2)
Bi
Mines? > OUYLI I= node,
Y
Pee EONS brdAdturemanTree chan dasary
pnt ‘ereth), int Size) §
Stach Minkeap K mines? = CreneminieaP (Size);
Forcing 1207.96 Size y y44)
MinieaP) QU Li Je NEWNMe( Jatariy , y Cet 59 7
minveaP SSiz > size )
woniAe Cminieat -) Size “1 n¢
Stuck WAFEMoNNele A pee) = OXHACHM Confess)
« Sprncp Hureman Node = right = EXHOEMn (ringeapy
pine ae de K merges = neD NaieC*'$?,
ALet Sones +rUght2 Prep);Melied D AeFL = Ach ;
Mertged -) rcigh) = rugnt, :
InseraminieaP ¢ minkear merged),
reer) exbnacimin(minnear) »
3
void Hook 30k ame
PruntCodes CSHwcp HArrManNode x
INt b0P, Chare CoeSL12ET Stax ree nips
VE Crem} ypeF+) 4
QuutLtorJ=0 y
preintrcoles (rtae+ 3) Acrt , anry LoP +1, Codes),
JE Crt00t 2 Kignt) {
deen [poP)=17
Prontcodes ( rteot ITUGA} AHN, dop+) , Codes),
TE (pret) Aer+ AQ { re00d Deregnt) £
PRInte C87: M, poop) data);
ales ina els cae
Prante (7d, aneci gy)
CoseSCcint) moot data ICi7~ DALAT +9!
y
3
Codes f Cint)Root 3 hae Skye;
Prin “\n'))
3 *
void Hurrmancous Chae dadel7, ink FHELCT, tht SIZ
Char *®4exe) £
Sirace HUrMonvose ® 7004 = fuiadbuseman Tre?
Cdata , Fred ,Si2e)
et WT MAX. TREE - Hrd, Peo)Chor (odeS L123] [max_TREE WT T= £03 mt
pronrcodes (rtook, aur, +0P, Coges); i
ia
Prunte CW Encoded = TeXE: 7");
Fore Cink j2 0, FexXtCi = ‘o's j++)
Pronte ("%S"
, des f ti ’
Prunte Cyn”), BL cing ECT),
wnt moan) £
Chon text CJ= dia, 0 And OF vibHanr CoPrS. |
pnd ruch istory , 15 a Cou Haj
Cophivates the Senses, Frtom se ’
Maveshe HIMalags +0 the serene
backwaters OF Kerasd, its
d)verse Jondscares offer Oo
pesg+ fon +e eges. The arome
OL SPI@S Warts $Hrtough Jes
mannetS, hide the Sounds oF
ancient —Chonts echo th 4epies
thot hove Stood PH Censure
Indials cartune 15 a te pestny
women with Ehreads OF ttAdiHay
7
SPILIdUBAity , A AHHSHC EXPKESSIay”
The cClavon$ of Indith Cuisine
SdmphohY oF Spyes a a
ners , tenmaAize the yasre
puds B deave 2 108tng
pMpression. [Ndia, 2 AandQE COMeMASIS Wonders , I$ a Jourency
or dISCovery nods ACAVeS An jndedibie
monk 0M Fre SOHAL")
wr Frtedy 128) - (01) 7
Fort Cink =0) + exe D1) Je ‘ol, TA)
Free (Cint) bextLi 7] iy
Chor gaa 1287),
thy «Facer Dara (128] , Size =0) loi,
FO CINE D2 OY LID) IHD si
TE CFREPLIT DOF ,
datafsize]= (char) i;
FrevaraLsizeJ= Frespi):
Size aj
MO £
2565 nit
ae cous, coves: ny)
er
gat
AN statin
wie dt
0) Apher ‘
ion, Pw
3 sdangionea 2i
on aden teenie aa cienhdi a deseendeiiome Ea at Ll oe em ed Ded
i
;