Download as pdf
Download as pdf
You are on page 1of 29
wite(prionity(stackop)) >= priority("e)) print("%c", oP): push("e); } ett } while(top != -1) { ; print(“%c",pOP()): } OurPUT: “Eton te Ete qt [a tb) as CaA-%) rr aback Ae postfix express ton Tewesutont Department of Computer Setence and f Printf("\n Enter new ele scanf(" %d",&ino); Ptr->info=ino; ment :*); else % Printf("\n\t It's: Okay”); } else i Printf("\n Element %d does not exist in the binary weet retum(root); OUTPUT:- \. [nee btnany tree: Ar chekeRe Prom bmacy tee: 3: Search ard Replace g \: Saag ; I Enies A chotcet | oe Entex new efem ent 2) ge j +ve btrany Avee (8 tlk 7 \s Trsext In binary tree: %. Delete from binaw tee | 2+ Search on Replace $3 ue ent cag Entew a choice r| ot enjes new atement 10 af He “blrany WWeerg } L012 DN A Lab Record-DAA igh 1¢ of Computer Science and Engineering : eee b Insext in binary 4ye0 + A. Detete from binary tveo- B > Qeoech ancl Replace enh enten a choice’) Enten neto elemend: irony tree ts t touts \* Treext tn bivarsy foew i * Detete om Girne tee re 3” Search one replace + emit. tex a Choice : Q Enter doe Clement to be teteted +1 i te birany dvee ig; Loaie % V Treent in Binary tree, Ay delete. Prom biro 2+ Seomch or veplace, Ms emit. mt Enter Q choice! 3 Kearny ord replace SYertIon tn Dlnarry Ame Enter the element to bo 8 # a a ; hitch toas Seemed ts irk ta notre aha eBheg entex A chee: y end of tte peomoms Redatso ~ MART Nome Sita Rx Department of Computer Science | and else ; cout<<"\n\nThe element is not found”; } int bsearch::bs() int =1; int h=n; while(1a[m]) l=m+1;, else return m; he \ } return 0; void main() { bsearch b; clrser(); b.get(); | 2 My int s=b.bbs(); i , b.dis(s); getch(); Tnkor the value bo Final 22 o> ies pound location 1 Department of Comput a Oo Langue ¥ Te above. (ae # Include staiohy # Inctude Atonlohy Int matne) Intann[aoJ, 1, lew, Wyhy mid, NEY Print? (enter no of elementc !” )> te (4 Bo) » print? (% ae arn elements =) 3 toy (i=0, tan 5 itt) Sean€ C¥y?, Yann til); a Port€ (“Enter He value te Pin); Beant Cr.” K kew)s lew = 0, hrgh Saree ln Mid = (tow thigh) / while (low £= hea) Loads Department of Computer Science and. By else high = mid =1 4 mt = Cow abeyh) Ja 5 & Clow Sane ’ Potrre (4 cement ts ret Pound") 5 < uxt Ua Enter 41a. Kee oF element! 5 Entes AW eps oa ements \ SM AG Eniex +42 Value of 4 1 We found lecakon 3 Enters te volue of 2 Clement vs met Found: OUTPUT: x Eoion te number of elements: 6 Entet 6 numbers \ 2 4 oie Enien Ve numben of search 34 34 is poesem a locatton 3 + a4 i present L Hime th once x Emon He number of elements Enlen 6 numbers \ 2 34a eeomc a Ais not present in annoy. hsort(; OUTPUT: Entes He numbers of element | 5 Enter tHe elements = 23 lo US) cas 8 Sonted element = g > 10) 1B 9239IU Department Computer Sens eT science and ENN A°%d",8ev); bfs(v); Piette rose which are reachable are:\n"); forlic si<=nsit4) iftvisitedfi]) printf"%d\t",i); getch0; Riven of vesttces 15 greph data in meetsix ba for(i=l;i<-msit) { iftreach{i)) count++; } if{count—=n) printf("\n Graph is connec’ else printf("\n Graph is not connected"); getch0; } OUTPI Entex number of Entes We adjacency motetx ! ted"); vortices (3 connected ab Record ~ DAA Lab printf("\n Enter the source matrix") scanf{"%d",&); dij(ny,cost,dist); printf("\n Shortest path:\n"); for(iF1;i<=ni++) ii!=v) , printi("%d->%d,cost=Med\n'v,idistli)); getch); } ourpur 13 Enjes te number of nodes Entes Aha Lest mati k V2 a2 a] BS aa ese 6s ts 4 Entes the Soucce Mahkrt, 12 el | est =O 322), Jost = 164 3440 Department of Computer Science and, { J char arr{] = {'t, "i, 01 ep int freq{] = {5, 9, 12, 13, 16, 43}; int size = sizeoflarr)/sizeof( arr{0)); HuffmanCodes(arr, freq, size); return 0; } UT. Ps cia AL ey At\1 00 6: om © Sa) cost{a][bI=cost[b][a}=599, } printi("\n Minimun co st=Yogn getchQ; mincost); } OUTPUT: entes the Numbers of Noches Entes Ho \ OAM CY” meakets 4 Edge tt lt2) cosh Eagez! LV 3) tosh tg minimum cost = 5 int n, (1000) Lk; Printf("%d\t" afk); } 5 st=clockQ; QuickSort(a, 1, n); et=clock(); ‘s~(double)(et-stCLOCKS PER SEC: printf("\nSorted Numbers are: \n for(k=1; k<=n; ky) printf("%d\t", afk]); printf("\nThe time taken is %e",ts); getch(); } OUTPUT i Entex< Yow mony nambers \ 4 Two wanclom ee NO UL 1a4GG 62324 2560 Sostes} number ane u include (skdro hy Vold gutcksont (int numbewT2 nhiod, ys > pivot ptemp 5 W Nat < lost 5] jin Sivek, int laste i Pivet = Prasty iy f= Pits U = lost white Gays SK \e at D i Ftmvee tl <= numbesLervet I wera 7 at, , wonlle oma mbex Lf] 7 numees Sooo Ca Ge) Cplvetd p) Jemp = numbes Ct) ” Bate = number 15] nNumbex] = temp’ 3 4 gi - temp=) numbers Lp lvot ] 5 5 ees LJ] = temps ‘a ee: bes Department of Computer sei lence and Engi int mea nl) tk 1) count 5 Numbey j mi? (Hew men ail scan P C44” RU print (i Enters Mel wen 4 ae fon 1 Slo tdco ae , count ae unt sy t+4) sean® (poh 7, A nuevos 373 | qe Soss(numbes, p, eri esi ’ pirte ( "Oxdes of feted elements ' 3) a pow [i= 0+, TK counts jee) ieee punt UL" ae , number ti])5 nexury) 0 5 t quips — How won gales S ehoments: 2S 1a p=der of Costed elements ® 2 12 230) Ose ae ge try Jo « elements ane you gens, fo en! {2s for(k=13 k<=n; ity { a[k]=randQ; Printf("%d\t", atk; } st=clock(); 5 } MergeSort(a, 1,n); et=clock(); 1 Gouble)(et-st/CLOCKS_PER_SEC; Printf("\n Sorted Numbers are : \n oy for(k=1; k<=n; k+) printf("%d\t", a(k}); Printf("\nThe time taken is %e",ts); getchQ; } OUTPUT: Eniex how man Numbess 16 TRE Random sh VR tee G33y 2eBood Aes cae Sesjed numbess ane 41 6334 aye} Late E Numberxe are t : _pAALab ab record Department of Computer Scence and Engineer" | Heinclude dstdre-hy 1 Hdefine max 10 35 cea Wi alld =JSie, 141052 %> ea Oe: : inv Liel x pnt a ant 169" vol mesoying (int low 5 ine 1151297) eee = 04> 1 2= mic 41 > p= e's os Brea a< = atrial? yitl = oe ! ase eta) = aba 15, 4 (2 ) 0 sla : = i Department of Computer Science ana Engineering mi = (loro Aran l sont Clotgsneam goth Cnr yy meron 1884 nigh); 3 “Ase REALTY *, My jot ™ OF . int we perv? (¢ Let bene \9D5 foo (i=, ik=maw stay psn (Ona) alt]), Soot ( 05 max), poirth Cay et after consttiy \n™)5 Del ses ‘S TLEmar 5 qt) Berint? ( "ya Ousp i= Uist before Sosttyy', (eee ole) SS) A is HL I m6= (a[1}[0] - afoyfoy) + LO] {0} +vfo}[1p); m7= (a0][1] - anya + CLIO}; e[0][0] = m1 + ma- ms + m7; c[0][1] = m3 + ms; e[1][0] = m2 + ma: e{1]0] = m1 - m2 +m3 + m6; weet Printf{("\nA fter multiplication using Strassen’s algorithm \n"); fori= 0; 1<2; i494 sj <2; j++) OUTPUT i A Ertex +e 4 cio memommec manne n Entes the 4 make of oe Lab Record - DAA tay ih MUL Beech on using Stracson’s alopxi Him Lab Record - DAA Lay Bee amine Vvoluc. of erop sack 43 the numbes of object! 7 ws the Value : 22 He profttito 382 Ents the value 4 Te enves We prokiy Ya = O AB AIG enters he vole 1 54 enter WR profi 9 Py = O uae Enters Me valet 93 enter Abe Protik: 6 RL= O Verarg Entes the Volue t 44 Enierx phe prefit 15 Pai > OMS Es Entes We rplue fur Enter te predresy Yo = ©. 0495239) Enter te Volwers Entes We yokes 13 Ox = 0.594935 23 to 34 ae a5 4y Ba e -34 \. 4229628 45 a 4y B\ Department of Computer Science and c.astie Lab Record - DAA Lab nt of Computer Scence and Engineering ia ers ed Eagnering A tab Record -DAA Lah) else if (Lfi-1}{j] > L{iqlj-1)) ing else = . . COULE< "LOS of "<< X ce" and "cc Y << jg "<< les; int main() { char X{] = "AGGTAB"; char Y[] = "GXTXAYB"; int m= strlen(X); are &|LTXAYB FS TAB Lab Record - DAA Lab vid main() int in; clrscrQ); the number of Queens\n"); scanf{"%d",&n); (n); Print{{"\nTotal solutions=%d",count); etch); “gee } OUTPUT Entes the number of Queen ty ertol Solution: ile Department of Computer Science and Engineering ~ system("cls"); printf("Player 1 (X) - Player 2 (O)\n\n\n"); printf" | | \n"); 4 printf" %c | %c | %c \n", square[1], square[2], square[3]); Se Ge printf" | | \n"); printf" %c | %c | %c \n", square[4], square[], Bacutigess [| _\n"); printf(" | | 0"); ; printf(" %c | %c | %c \n", square[7], square[8], square[9]}; square[6]); To] \a\n"); printf" Playe« 1, enter o Num bow 1a Player 1 Ca5_ Playew 2 C09 y isa «w | Shae a. ‘a \4 Ployers 2 > Entes a numbes 16 vayer | C1) = Plaqee ates Aa er ! Ng i Bet ‘ loyew \ y er\er ul Wen been 5 Playes tury - ¥loxj end (0) ! \ \ ae ( wl xix ) 4 \ ‘al l v loyew 25 entes a number Player t CKD — Playes abo

You might also like