Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
67%
(3)
67% found this document useful (3 votes)
5K views
127 pages
Data Structure Quantum Series
Ds quantum
Uploaded by
aapalaks
AI-enhanced title
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
Download
Save
Save data-structure-quantum-series For Later
Share
67%
67% found this document useful, undefined
33%
, undefined
Print
Embed
Report
67%
(3)
67% found this document useful (3 votes)
5K views
127 pages
Data Structure Quantum Series
Ds quantum
Uploaded by
aapalaks
AI-enhanced title
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
Carousel Previous
Carousel Next
Download
Save
Save data-structure-quantum-series For Later
Share
67%
67% found this document useful, undefined
33%
, undefined
Print
Embed
Report
Download
Save data-structure-quantum-series For Later
You are on page 1
/ 127
Search
Fullscreen
Astra Bats Sypen 7 Ponan e rna iiConary] Introduction : Basie Terminology, Elementary Dato Organization Builtin Data Typos tn Questions Answers a] [Long Answer Type und Medium Answer Type Quenionz ReeTT] Derine ata ctrveture. Describe about tsnced and type ARTO SOG, Marks OF] Why do we awed adata type? meer] Data sructure = ‘nly thecloments sored but ave tei relatonshinecacratier 2. Dieguito css ehematie ope ie of pena See Data iruetureto needed been 1 ichoptounssanth ashp fen element wh he ther 2 Kin ite onznation saanatonsettint money Dieeng acess: Bie cee 1 Nocainse an srt 2 pended si dome Examples of non-linear data structure ae tres and praphs Need af data type: The datatype teed becuse determines lt pe of information eam be cored in tha eld a ew the ta can Be Far {Ope gas) Disa some baie tenclalsny aed aad ementay data organization in data structures, Array ad Linked Tit oo dats structure ; aa pl wre sre of wnues Adak em fr tn ‘ay snes samating at ‘hie nay be asigned valves Field acid easingioelerentary unit ofinrmation representing an nar certin attributes o property 4 Mesos anran eho clletion of fet vales een enti. fats umentcesomotrecurdet tents na veneniyst Data onganieation ‘ach recordin file may’contan many Held tens, but DeteaeE ny ceva eld may anuely determine the recordin the Ge eseNel2a fecaiad primayy hese andthe ales fy Kein such eB | Queia ] Define data types. Whee are built in data types in C7 Cala sypor ao defined ae the dain torage format that a varible can Se idenee penn zpeceuperetion fs Primitivedata typos: Pimitivedsta typesare clasibed at ereare wed lo ore whole num, ‘on 1G-hie machine: Sizetbytes) | Range | Format fe tmtewor type In specie Ee a siesta or esa Biortint 1 = 1260127 ha unsigned mortint O10 255, ‘che Tong ne oF signed | Jonge 4 ~2aarasaess |! ut | 202,147 985,687 ‘sere ong ae a to4.204,067,205 | alu_| ii, Floating pots sUExpe Floating types are used to sore peal mani‘Size and range of float Array and ake Lot or ae _ Bitvenee:Shorynstracton uated ene Scand age Cer nested incre | Sn fant TINGS OF chasocter type on Weenie ctor vam 2 Reto beemcee re es a_Ratolbcem ie = feu em oer aa ERRT] tow th etlency of an agin can he chased # ecco es Esplin she lienent wae af cnstanieenn 1. Void one: Voia ope mamas ee Eee wilh ine ni, * IY od oy pan Pegi en det oe beni be Nowprimittvcatte pen £ Setar a 4. These are more cophistiented data t ree ‘Bass ry more sphiinted dla ype des om fain ne a etry recom cfm slgrton Ditteront ways of enalgeing nw aigorithan Tho non-primitive data types ceplacise on of harunncins Conn er hao oes OD abet oath chinn wise whe atts Noms. Fer cxtmplarraga hninand ene OTM HPO Sicha ae 2 Riera urn ine of algorithm a pe en on ira ae sng Sete setapae pent 2 |e b. Avenues eure fanning Algoritinn £fhiencs of a Algor Ti IP" eapetodbhaviour en tony randeny drm rom Se ied grondcrinten a 2. Rvoverngr ate rig as of an ales aa eine : Questions fe suaning time for average? Input Spey enaee ee Bestence Tanning tere? ‘Hamat Answer Type sid Medi An 1" the bchavioa fe egerthm when inp ited inceder- Yor = a — ‘example, in sorting, if eloments are already sorted for s specific SUuSEnaeeaivenees ve ‘Gee FATT Detine algorithm. Explain the cetera an algoridn smast 2 Ther rng nrg empty satisty. Also, give its charaeteristles, “ GETE | peti comptexity and its tes. pers ; 4. An algorithm is astop-by-atep finite sequence ofinirutions to solea RE ie i ey algorihn ste the lowing rita: FD Thore are sere or tors qunnine which are etoroa plied ‘The compleaity ofan algorithm Mis he fein ft) which gives tho running tne andlor storage space cequirement ofthe algorithm terms ofthese nf dhe inp da,Data Structure 2 the corage ace eee an algorithm simply a mil athe a Worst cane The maxis sate offi) thr any possible faput BL Average cana!" expected wal #f for fren) pase pe The minimum posible value offi fr any pons ‘Tymey of complestty 1. Space complenity The opacocompiexiyafanagirthms the noun strmemory needs trun to Samaton 2 Time complnity The ine compo ofan algeria th emo ‘GeeTF ] what do you understand by complexity of am lyoridhm ? Compute the worst case complexity forthe following. for G20; }2S* joey t for Oph en in t i int » Fawr] I cP neg es Sonata tae oe ag] ay sev ns emcee cy fg ihe rontion hetson ti tne nnd epece complesties of at algorithm ? Sustlly your answor with an example. (ier 2018-1, Narks 5] Taawer Complexity of an algorithms: Reler Q. 16, Page 1-04, Unit Relation between the time and space complexities of an lgoeithint 1. The time and space composite ae not related te each other. “They aro need to desiribe how much epacclie our algorithm takos based on the input. For example, when the slgerithm has space eomplesity of 4 beacesrsems) = a jo lgorithyy ves a xc smal a Fee Senta depend om the inp FOr every ava th see throm weak the rans yates} amount oc Fees eat taces inion Tat we erate ada Toc i et enc hn much ie ov alzorith {Mihi bud on the tone of the spa Srp hen teagan ie comet of: Fe wa oe eno matter howe bg sto topo always Bian Gi, Otto - again ts based on the length ee it nesontice finde int printinods) functions pantsot alts) Jo eis example, bot ace OCD apace ae wa ds not create tins ‘hjseswhich swe that Hine sd space complex mie be diferent. Assmptots Notaeioie ‘Bir O% Big Pasta, and Big Ome QasL9. | What is aymptotic notation ? Explain the big ‘Oh’ ‘aewer | 1 Acyrptte nection oa shorthand senyte describ running tine fran algo, 2. Westie shat stays within bounds ‘5. Those are afbo refered (o ast cage? and worst eae! ecenarae Big ‘OW notation + 2 bigcistrma methtotesprasing he voparhound ofa alga {EL ts measure oftho longest amount of ime it could possibly take fo thealorithma teamplete 8. More formally, for non-negative functions, f(s aif thore exists fan inmeger ng anda eonstantc > Oaiach thot far all integers n > ny.ta ccermennisy es) 4 Thon stor a wiglon af 2 ~ i, HOGER = cma Sef sl Rector ion a sma a) «Og Petes arene am erred f i | tm =04si00 “hp ; GREETS Seen peed that ie nytt . chara Bandra Sasi att oa vu NOUERIUZAUT ADT ee Sy ee cota > ara Pig 19.8 ude omega tatasion cays SA “SEY 8202 eT] wee wi Seat dentro and hte cayepealy tg ‘QEoTIRT] wn completo a egoite?Repanvantous Pe eee ee Rotations used to express the complexity ofan alzorithe ‘Nina arate SO ART Bor Ta aT © me Space Trade ff Abstraat Dota Types ADD). eae a= Complexity of an algorthes Refer Q. 1.5, Page 1-64, Unit Notations used to express the eomplestty of an algorithon + z | Long Answer ype and Meciam Anneer Type questions 1. O-Notation (Same order) 12 thie noadion bounds a funtion to witha constant factors. ae We eay A) = dyn) df hore exist poste constante ng yard ‘Questione-Anewors such that tothe right of, he vaioe uf in) always ce atweed PE sin dima pi sae SoU ban Flgimand end inclusive Gea] wen space trade-ott in bei ot fo ccampte, it) q on te) What do you understand by tine and space trade-off? Define the eye) abe tn Yerious ammpotie motalions. Derive the O-notation for Tinea search ARTO BOUETD, Make 38 Answer Pig. 310.1: 3 ‘Time-epavetrade-oft 2 On-Notatton (Upper bind): Refer Q. £9, Page 1-8A, Unite Td mops toe ff efere to acne botnet cgoritnic tions & ANotation (Lower bound) ‘tata proses pablo hat slows decease tho rsing ti of Stn gare soon ty sneceasg the space to Hore data se ‘Thicnottiongivesn lower bound fora fanctiontowithina constant] factorDate Strate AIA (CSAT-Sem) 3 ine smee irae oa asin where thera ciocy (pertarinance offcone canbe schoned actions eee Por Example: Supjose, tna fe itdat sored Nariows owympatic notation Rue @ 1.10, Page HAA, nt. seshonafheoray exon unycepansos ne meee at Be, TH 0u, (Average ewe tera etue hat MEN doanoter, an thats guy riggs mee ears tess seen he ean Tin) = 1.) +2.) £8 Cn) 4) S423 we le) Pactaeacny re =O + 3 « O49 ‘Mera cana Worst cate aca when FTRM nthe ns erent inthe array Dr leot thre sta in iisatuatona compere Tia) = Ora) = 0 QeoTIE] what do vou wndarstand by time-space tradevoft 7 explain best, worst and average ease snslyai fn tha respect with
. Insert a end: yet serene Slowed ptr eps ‘te = strut node falloetsesofetost nod) iro NULL rath Clink Tate oerflowsn"h , Prntl Capt new node inormation’s: Sct (eh, ete > nfo cote Ora ‘le et Knlet= NULL) ent wept> nk sie tine = NUMA: we acer qen sel ae ye a ia AA ae" ymaaeioatrt nad te tbit et covert 9 ae Santos ete > 0 SE Chapet bv fae rece as ner which tortion wil mde"): ‘ie pt» to ats) Si date ent 9 ‘Resp, septs Hua “-NULDT unt CaaberBow 2" ena ihe prt = NUT peenptee> ok: i (pe sink = NULL; eeigtrh Delete at beginning: oid delete Regt ( rect oe pst aaeer == NULL ¢ et anderflw 2") i pe= st Frat = pr liok; fewiot iData Structure WE Delete ater slomonts wid deat giv tat 54 Sel nse a Ieee ata Pit Cuntertaas, Per fine: Print ipa infrrtion ef det be de Sat ad at eee she (ptr Sot tea cet pee pone pt lakes pte tk fo (ptr, piste ” ‘Tae TH7] Write algortehm of folowing operation for ines inked lists Traversal fii, Search an element 2 Deletion at end “Answer i Traversing linked Uist: Let LIST bas liked isto emery. Tis algovithen traverses LIST, applying an aperation PROCESS fy wach “lament of LIST. The variable PT poe othe nade currently bay 1 Sceirn = START lintiatines plaier PH) 2 Repost Stops Sand ¢white Priet= NULL, 3 Apply PRocEss ts Pri» INFO. 4. Tasortion at beginning iv) Delotanode st peaitiog location ‘Sot PPR» PTH» LINKIPTIC now points tothe nextel itind of ep 2 top 5 Exe esas? = Tiere START is a pointer variable ero at bees eM athe aloo eh Fe rae ae Seat nce Natt, (nga ear ono BEARS RgEL (asta NULL LINE no acdrese a Delete node at specttied position : tare START is a peintor erie thle contain te addreas of fist nade, PTR lw pointer eral fontaine dees of ae be deste PREV ia potter aration Prints ta previus nde ITEM ithe valu tobe Salted SERNREX Ke, tile PER with STAR Exner, lier START Neo tre Se rrENt INFO flay EEENo" tee ca sch SPAR sa pintervorible whieh Erementar ae eaaar oes Pca een EES RT Re he value to be caagehed sili PTR and Loc {Chock s rTM mate INFO fet iP rn: rds proses ab oeation LOC Pits pre = LINK Ibfove PTH to ae nad Toezuaee fiacresent Log} fens afin, Tend ot We Loos! TeiStaleh == NUEL) Then" (Check whether Lists om rns Ueto ep. ‘le START = INFOS ETEM Toon Thoski PLR=START re START STAnT->1INK (START now points to 2d Be PTk=Srarr, PREV starr Rigen Whtetett = NULL EGET SINFO == TENS Then OFLTEM matches with PURE PREV > LINK = PTR» Beccein 7H Linn otDaa Strectre 14. PREV=PTR smart Chats Pro rs RES Lm [End of Step 10 19, ° vm 7 tender Ley ve, Pein fr ae itelersen ae + BaetonatandsFezest9s a pir nih nite ‘ofoto be deleted PRBV a pleservaratie wes ones proius SOUS Tamaiglne yeu tone ace Y"“iecsrantt == NOTE Then (Checkwhoeher hat x omy 2 Paine nko Asst trempy, a Rte © PRe-START, PREV-SnART 8. Repeat White (PRRs LINK = NULL) 8 PRov—pen [Asclen PTR to PREVI PRR” Pie LINK (ad of Whe Loon [Btowe PPR to nent noe 2 FEMCPER-AINPO Anson ROFO flare to FTEM 2 IRDA = LINE =- NULL thew tony one nodes eft fo, stanr-NULL (Assign UL to STATE 2 PREV.» LINK = NUL, {hotln NULL talink fad soon et nae tod of ep 90 0, Delee PTR “ EL Panes TEM dlted (nd of Stop 319 ‘Guo LB: | traplement none Hinked Hat wsing pointer for following fet "cert at Dosinnt i Insert at end fi Imsertafterciement —¥. Deletoatend Ye) Delete at beginning Ti Delete after clement Vit Dinplay in reverse order Aaswer Fincalocetio > Fincludeceonie.> Finca
Upper crust simplelink ‘owe simpllink next scsoacesnrsen | metlon te nner a ee Fog pnoae ; return ji. Fumetion consort at end: th Tin elnsert_endinede *Pi SCF pocermatsiatnte sera ered ae td ated SHheoaan NOD 7 ' np nnont = tnode ONULL: fouah : 1. upetion to fnsort after sloment: svtignt? stentate pt Zhuees ‘Bint ntntar the datatafter which you want to enter dated”) ents ‘wiotp data pes emp =e tpalloetzsfinade); Dnt \ppatr Ue inert dat" Ennis temp odatn {emponent=pnext ocorn nl iz, Punetion to delete last mod fede endibode atER ACSI Sem go neet = (node “)NULL; Frootp eeu, i ‘odo delete entender ede a: Free umetion to delete node after clement’ ‘odedlete.sherisode,*y) ode “tem a _PrinGf"\nktnter the datalafter which you want to delet: Seant20" ah, ” Shloip Senta = 0 ponent fomoproents | perurn a . Function to reverse the lst: rode teeversctnodep) | ode “a. seas (OSATSomD 44 Inaction and doltan f oder are eater and offceat Unde ey Iisa ie proviges uti in oscrings toe aan speed ae ‘e's neds can be deleted Som any postion isda ned is {5 Mary mor complex aplication cam be ely arid ou wi 1 More memory Inthe linked fst, the ; I i & i t t i i i i ts GeeISO] Write 4m atgoricnm that reves lemons tn singly Hake Bit, “Anaier 1. Toroverao liner linked it, three potnter Molds ae sed 2% Those ore PREV, PTR, REV which bald the dren of revi surrentnoge aru will muita elise a Kopeat step 4 while PTR t= NULL : REY = PREV eeeData Seusture Tend of white op START “PREY ‘SHELA ] Write aitterence hetwoon array and linked Ist, Tarver ‘B.No Array Linked tit | Am array ic & list of nite | Aliaked sti alinene allen enter efetemwas Se data chements called nodes 72 | Blements oan be accessed | Elomenta cannot be accessed andor. tandemly. tena be accetred only equentiiy ‘E [Aerayinclansitedaes | Aline list can belinear, doubly a LD ereay Greirestartinked it fe orray 4 [sen array eloment 32] Location or address ofelement =| Independent and does not | stored in the i pat ef rerioas have a connection with | clement or node proviousclomontormithits | Becton, | Array elements cannor be | The nadusin thelinked Yat eanbe ‘2dded, deleted once 1 i | added und deleted Irom the es, Seclored Tim array, elements can be | In inked int, moiiing the wade modified. easily. by | eucomplex process Sdentfjing the inex value, 7 [Painter cannot be used in | Pointers ore used in uakedis. PARTS ‘Time-Space Treas Off Abstract Data Types (ADT. Tower] “Trey orto wy Tinka ists double set f pints one tik © ee Leland ine ther pomune tothe preceding node ctl ed tt il node ae inked together By wile Kako Fete iit tcestn th te surest nd redeemed Tor Soya nok tin the 5 Bvoy ote he doubly inked ist ha three (eer sro [or] Fie 132. 4 Lit painttothe node in tele side or previous node) ie, LPT wit eid tne drow ofthe previous nae, RFT wit point tothe rode ithe Tignsde or nett nol ce Riel old the adareae ef tho wext node, INFO fed ore the formation of the node A doubly linked tenn be howe fellows ST Celis HT lot inte, Struct node “ep Mew nde Ap 1 odes Que TS. | Whatare doubly linked tists? Write C program to ereate [ARTO 201515, Marky 10] Aoubly Hnked ist Anawer Doubly linked list: Refer 1.82, Page 1-304, Ualt- Program *inchidecetaia >‘include comin ts Eitnaatieg sin boae fi Brace spe; erupt“ struct node tine; oidnain) Hi create) pach, F oid erate) Berwet no ty, chores Urs strvct node *) malo ace of teuct node; Print Cnt est noe nfomaa) Feat sed" pir vine) firs ipe= NULL; pr —tept=ept ot Int = pte Drintt “Prose
for mere node’); chageeeh Ur i aula pointer or following 1 tmsert at beginning ik Insore at ena ‘i, Senrening an clement iv Deleto at beginning. M Detete at ond Ui. Delete entire list anc J am ale seen a pute red mrt Ser ateantot fimp data = a stn apes ene fers nin = i Function to insert at ends fuitincart-sedinede "int ( ois “tom Temp = inode" attotataooftnode)), ‘emp sda = temp 2hext | NULL: ead = Function to search an clement : sede *fndtode hy int at whiley>nent I head é& h-odata te af)Data Structure shinsnost = bead 8 hdate at) Fesurn node NULL FPunction to detote at beginniog sot delete beslande node") Fihead == ode NUL pratt ali ieompt fetch, lehronert == 01 tailsprew ULL Function to delete at end: foid delete ondimede hy node 2 head ®= Geode SNULEST Print ols Isom i Ighosd = ts frei ead til = (node NULL: fate tlre fan baeate NULL: ‘Aecay and Linked List posawesar sent __ Array ‘eit diplytond "1 Sree beta Panction to dolets Miuies baeote hs tse = ULL toe y GERTAE Weitelgoritom of folowing operation for doubly Haked Ik Insertion at hoqioming 4h, Doletemede at apocifictocation vette an algorithm or € code totasert a node in doubly Hk Uist i med 1 raworsing of two-way linked List: &. Forward Feaversing © ite rs ‘Repeat stop 3ta4 whe PTR [= NULL. Brose INO WTR). Pree RPRPTD. jackward Traversing Pit Pues eepeat sep) wile RPT OPP) Pike RPrPTR pent se 451 Qo (hile PER NULL. Process NFO UTD, Pine LPT rw S10 srewerri i Se SEL Ag ae oar [END oW Loop; SERTEMP = wi PR PTH >Next PUR > NEXT © PREY ARSE VEER > NEXT > PREV Th 2 4 & SERPIR teu» weer 3 8 iv. Deletion fromend: 2 HEAD 5 Repeat Step a WHILE TEMP.» NExT!-NULL. 4 SEPTeDi'= TENE > NEX? IeNp o# Loar 5 Ser TEMP > Phnv 2 Nex" 6 PREETEME ‘single linked lst. Double linked list takes more space than single Tinteod Ist for sorting ono extra address, Under what conditien, could a double linked list more beneficial than single nice list Taawer | srojram to delete a specific clement from, Prot ipclute casio 1904 CSA Sern) gta cei PRiinedtet node ‘we Node fanaa raat Node ext X i ter) tothe 1, even a sforance(pnintr to palate) to the bend tg ice Tacetg nn tad othe front oan seg pesbctrct Node heat sc, nt or. dna) I ata aarti nour an ‘new _node->data = newdata; Naru esa mares : A lamar ile bina thind O 1g es ts te thea Tees erate ; Temamumn Pett Tiere hesd nods Se sca ees ; "head raf emp eat: Chango head ‘1nd prosious node of the node ta bo deleted for aS" 0;temp!= NULL at «postion = 4i¢0) ‘St postion s more than nurber of rods feng = NULL temp sneas NULL) i Rete temnpnex ths node to be deleted 1 Store potas to the aext of ade to bedeeted ‘rutt Node “okt = tersp nent sts ‘Wn tho node fro faked ‘esitemp->next): Pree merry mponen “next Uninet deleted node rom tit {Bie fenton print content oink ttn fomData Structure LSTA (CST Som oid pineistctruct Node "moda Piet e aL Print" node dota 1 Program to tos ove Sanctions"! int mand 2 Start with tn copy ie */ (eruce Node head “NULL, pashan, 7h pushhead, 3 Posninead, 3 prushdhoat 2 prostltthend 8) utaCrented Linked List", Patttictiaedy SeleteNodet eed, 2; Dta\miinles Lat ater Deletion st position" printLisuiced, i Doublelinked list more beneficial thantsingt inked! Te uble linked list san be traversed inn forward ‘deeton 2, Thodeloto oparaton in double inked Hist more cent pointe the eto be deleted given 8 Indouble linked lst, we con gully Incort new noe before a given 44. Tedoube tinea st, mecan gt the previous na using previous puter ‘at in singly ke et we travers he ite ho provi nce Cirelar Linked Hist ‘Quortions Answers {Long Answer Type aid Medium Anmwer Type Questions 138A (CST Son 7
it Grease treet opt, cmonPe opt spe Pleo epee tot pee pat Print Insertion indone\ary, idea ‘Struct dlNode *nPtr, oe irae nate Jelao if tanp->data = dat nite tpn ae) impact RO, toe a hie imp-sneete NULL Ate tmpodstat nen ‘mp nest m= NULLA tmp data edna Print-Given dnt rae eka | ele if (tmp-onext NULL && trpdata = data -nPtr-snext = tmp->nen {tmp >next->previous= tmp->previous: tmp next = NULL: tmp-sprovious = NULL: freetemph printit"Data deleted successful totNodes— belae if trmp-anext w= NULL && tmp->data == data) nPtrs>next = NULL; tmp-onext = tmp-sprevious = NULL; freevemph, print*Data deleted successfully\n"h totNodes— ) 1 ) To sore the list according to descending order: void insertionSort() struct dliNode *nPtrl, *aPtr2; intij,tmp: nPtri = nPtr2 = head; Ants 1.804 (CST-Som-3) HOA (CSAT Sem) Se amin ie och
next f= NULL t printi*"id <==" temp-> data); i prints t 1 Que 1.38. | Write « C program to implement circular linked following functions : Searching of an element Insertion at specified position Deletion at the end iv, Deleteentirelist, ewes] finelude
‘typedef struct al intdata, struct text; nodes node *head = NULL; > NULL?, tomp-> data);‘id insert cit en made Hh inca temp = tatoos ad tibsdlata ae {head == NULL Trea tony emt» hea ' lth sent eho) Bes tron tompeonest = hnext; Teoneat = tom 1A CSAT Sem) 1. Punetion to seuen 1 hon fay $8 lata ait Fetuen tiodor NULLE che : 1 Panetion to insert nail nt petted poston ‘oid inertcip poses ine woe swbilcteonont t= i log Blam read pow <0 prinef*\nPoaitiondaes ot exis fesci , Ign 20 pod tenap = radyalletine ena enum Ite 22 The heat LAB Asa Sem: ai) Areny at Licked st 1 ' ‘idle renin" mth nny, fete i Ingest me hd 4 rinitenede led Lit empty i ido Be hem 4 t fret 7 : detete et voitece etna Miithe-sunso4 1Data Structure Aas AteSATSem-D Que 129-] Write an algorithm to insert a node at the end #9 lecular liked tse, ‘Reowor Lo trre= Nuun 2 Whee oventow 2 goss tsporm, 4 SEFNEW Nope rn & Senem- pre excoe & Set NEW NODE DATA=VaL 1 Set New Nope Next= MEAD & Serine nea 3, Repeat Step 10 while TEA > NEXT a fo. Serres reve Next TAP exp oF Looe 1. Sennen ont Now » LNoDE PARTI yn on a Linked List, ncertion, Deletion, Troversal Palynomuat Representation and Addition, Subtraction and. Multiplisations of Single Variable and Two Vartabte Polynomial ‘Questions-Anewers quota Tong Answer Eype and Medium Anewer Type Questions plement insertion, deletion Write an algorithen (o and traversal on m aingly linkod list Aaswer Refer Q.1.27, Page 3-294, Unit GeetAr,] Weite a C program to fmplement insertion, ‘operation on a doubly linked lst. Anewer Refer Q, 1.84, Page 181A, Usit- paniesasom 3 Geeta ] waste 9 Comet inked st awer rtton £06 Penge © gract gate 88, set torwaraae pn ee be NULL? yn for traversal operat forward traversing + sing 10% Ente cea Vor, pte "iF: Prep PE ' - on for backward traversing Etaraverse 1 rust node * pte: SSE EBackward traversing =\5") Shite. (per + rot white pte = NULL prints sta \n", pt > imo): pore pees> pt NULL) FeTAs | Write a program in C to implement insertion sand traversal in efreular Linked Tist, tema] Pinshadecatdio Finshodeeonio> iata Structare 1 1 r voldereatel traverse) ner eg, insert-end Etete boat) delete pai nt eae end ‘inset freatot iteert eg); traverses SnseresondQ); traverse) delete toe; pec 1 ot ereatel) scrut node pts Sept: chores Pte etrvet node) malloc sie of trct wd) Briefing fret node ens epee nin) on ‘pe (etruct node "malo (ez of etraet nod) Print inp nest ned Scant a ept-> ina), Gunes Pri £CProee
for more node"; ube: fd toveree) ‘ ruct nade “ptr s print racrsng oink i; She pr te es int > nf Ferser fink ‘oid incort.bes (7 FE Na der ate ace? Give noon: 1 hac tomertow 0" Juin lag New Noe int CRRA Si t Gotan inks ; stink = St fe bau feet: pad sneer eal) S “ Bone Tata alle (sine Gtrut made FF gue tun i printf Cngst, Neve Node information’ Solar Cea dtr inf Inne Cpt tink te ead pesca Sie link= te fi olin et i ‘oid deate bos) i fruct uote “pte cents Hees NULLA rin Cundeetow a"): tye idk Seat;DeteSerectre estos oid let cat rt node “pep, ‘etaese NEL t beeen ‘hile ept > link = iat) trike fe Roce LA CuuTssems) GaciAe] mapa the method te represent the polynomial 1 Inthetineadrereaentation of pom ea no how cos of thece olor, namely soctTeien expen nd 2 Th oun ol Yl he a of tn acento orm Feld Cohtatns te mStre ot po term tha pon cot [ore | tok Pe Fig ta GE-bELHEE imeowe tt iymomisiarniesen9 | ee | vcore efi peony EEE 2 emofthe pom with de of tei on wine SSeaaeon Rene pebjwominls wring Hed sts: tion tn ae ee vaadg ae me le ropert st 2 £ Trmee gfe so terms ar ecu then eae ercanel torn insert num ofthe tame Cetin ‘ca Opie Dneg [eafle(prer fhe fst plyeoia) > (per fond Thon cet tr fons st olynomia atm pla He tacr the lam fra second polynomial . Voie Copy beremsningteraiom the non-amp'y pyro Pye ‘aamplo: Le uconide: the wont io vay somite SEV re dss dand tse wwe 7 We earwanalion ass Bet 46 1232 10x Pease eet is oes {1 wo polynomials, compre Coir corresponding tera fm th rt ado nd phe tarda the cad sole‘eauation using linked tat, Write and explain method to mult | ‘The matipistion ofp radar fosmid spertormaly malig otic ‘e,roduce the multiplication af two plsnomias flowing tops aro Deformed & Check whether sve given pelyaomtals ch 570 gon cmpty. aye eset then piper mulation ent se Second polynomial ie eeannod from eft oFght. For each term of the second poy, the rst pola ie canned rom Tell to right itd ences rai iy {crm Use econ panomaal se fetch ee hsoat of ‘he eoetBeivnta and find ie pane hy edatngtn oxpanents Te product orm already exist inthe result pte! hen apresent chitproductteca, Nee ROE eric ar cxample : Let ur conde: to polyno vas Pend perform multiplication ae WER DOR AnT questions Following qucetions are very important These questi reas bo aiRGUTA your SESSIONALS ax wells UNIVERSITY BXAMINATION. G1, Define data structure. Devortbe about its need und type% iy do we need naa type? ans; Refor@ TL. for mo; Jo mhieed fori=aii-emivey t poses eter @. 3. lgortm ? Justify your answer with an example. kenrg 38 What are the various anpmptatie notations? Explain Big notation. Bier 0, ‘What do you understand by time andapace tradeoff? Define Rewrel La What do you undovstand by time-sonce trade-off? Expl Dest, went and average care analy ‘espace i eter Q. 132 Suppore multidimenstonal arrays Pand @ are dgolared ax PCE 248) and Gist Seip 10:0) stored incom major Fina the length of each dimension of P md The numberof clementein P and Qe ‘Assuming bone advert) = 100, W = 4, find the effective inal et and earn ofthe clement i, 3 Write ditforunce hetwocn areny and Vink Het, Reter 139LSLALCSIT Sem) ace doubly inked doubiy tinea ian. Refer Q. 130 2-10. Write an algorithm or code to insert anode in doubly link 2 Tie in beg ees Ane, olor Q tan 11, Weite a program in C to delote a specific element in single elied ist Double lished lst taker ean aimed Hinkod list for sorting one eatra nddrers, Under mat Sondition, could a double lined list mare hencticia? than single linlced list. Ane Referg. 336 Write € program to create What is meant by circular linked Wt ? Weite the functions {0 perform the following operations in adoubly hnived et Creation of int at nodes: Torertion after a specified node. Delete the node ats given position. Sort the list according to descending orter Dis y from the aging tend Roter@. 1, 2 5 Beer Write an algorithm to insert a node atthe end in a circular inked ist. Ane Refer Q. 120, 00 Tae peeks + Abstract Dats Typ ocr Bh Forth + Biettive Stack Operations * Push and Pop ps and Tate Porte + jreinenation of Slack in 6 ates + Aplleation of Sinek : us and Pertaa xococion, ‘Praluotion of Postfix Expression 1 Merntion and Recursion £ co Part + indies of Recursion, Tal Problem Solving Using Iteration fd Hecussiort itl Examples such Se Binary Search, Fibonacel Nombor find Hanoi Towers, Trodenff between oration and Reoursion queer : Operation on Queue Greate, Add, Delete, Pall and Bapty Parte: Circular Quenes, Array snd Linked Tepiomentation otQueus in © Dequoue and Priority Queue 2AACCSIT-Sem-2)seks al cues Stacks Absract Da it Dats Type, Primitive ‘Stack Operations’ Push ana Pope GaeEA ] What do you mean by stack 7 Expl with suitable example, Anewor ‘Astackis one ofthe most eosimoy used data struture 2A stick, alg called Last In First Out (LIPO) system, isa fnear Hs ‘lich incoeton on deletion conta place ay atone oneal 0P 4. Thisstrocture operat in muck the same way asstack of. 4 trweneant to removes teny from stag af trae Lean enly be removed Fou the tp onl ‘The insertion an deletion operation in stack terminology are known SE PUSH ana POP operations Ss ie] en Stack after puting B10, 12,-8.6 - vps fo fa top 2 [a 2 [2] i [me ie o[-® = co steck ar paahing (wy scackaier poping clomente 6.8 lomeata 7,11 Fig. 214. BREE] Diese POSH a we Fes eecng rete incrons the top Pant rete espe arena ete tpetement of th Overflow: To check whether the Dndeflow check whether thes tack or Weeks | write aed efor @. 138, age 1-120, Wit rt ote on abet date te stack and write ed ion, we ne ereration +In pich operation, we inset an elwnen ont, te atheminsoethe erent. Algorithm: PUSH STACK, TOP. MAX, DATA ree ETOb = MAX thon wite “STACK OVERELOW and STOP” TREAD DATA . 4 TOPA TOR +1 4. STACK(TOPI < DATA 5 STOP 7 aperatlon: Ta pop operation, we remove an cent fe sek, Aer roe operation apr stack i decremented ¥ 1 Algorithm POP «STACK, TOF, ITED 1 PTOP <0 then write “STACK UNDERFLOW and STOP" 2. STACK TOP] “NOLL a Tore TOP=1 4 STOP PAR “Arrays and Linked Implementation of Stack nC.D4ACCSITSm 9) Quen Lang Answer Type and Medium Answer Type Questions GESEA_] Write a € function for array implementation of stacks Write all primitive operations ier] fractals h> site Ma 90 oy ak tax 6 po: seh ; cle Sete rors) at) pent Finite ~ Eatomet Froniiater Put the lement ebl-Afer Yop dhcksent tho stake sch ne tusk a0 , oid create) ' é chars i ‘rnlfCapat enone: Seanfeond tach ep Dd Preerenfor more element" Pret yiiteieers pitt) P5ALCHIT Se Fin etki iitopee a0 chin wordow" prim Tapt nw seman tosBAOr , oid ont Sw : estou princi nd seit = 0 , ‘Woae | w includes n> atest ‘ruc noe fi facings struct nd sk Sri ercatet travers, push, pops createStacks nd Quo Dr tack inv Provan ort pelcatter sh Une oement inthe tack in: bo i elat“Aftor op the clometin the stakes \n") etch F oid create i struct node "pt, Yop i chore De tstruct wpe *) malloc sizoa truck noe Printing tit Seank~tel per >in persis NOLL ept= qtrut node * malloc sie etruct node Drinitinpue mest . “i i vold traverse Feruct node tpt: uintriaveneiag otek \n bir tops smhie (ie = NULL? t printf Rd a", pte > inf; ptr per-olink i : void push) t feract ne “ot ser wage male Cizot ert node Iepece ULES Seantonde era pie otk beter , oie C enc de pt {tap NUE) eat Undertow 0", i Prato p= tink fv i TSA] What ie stack? implement stack with singh Hnked Wet [RES] Anewsr| Stack: Rotor @. 22, age, 228 Unit Teomeutacion weing singly Haked tst = puters ack Mtrcctstace nor intact soit prhtctack “tp, it ata) C ack Sree own = tack *Yallnslaeofetsc) Reva-sdate= date aworoneet=tatackINULLS tlop== NULL? i ; Sop mewn)fecal sy a Erato geo Potarntvaty 1 (QRSBFT | write a unction in Tomtaace to roverue a sttog wshig stack, (ARTO aor Marka os; What is a stack? Write ac, = Taewer Stack: Retr Q.2., Pogo Mincledoeetio ns Bincladeceenie.ke scl sting he (dein Mak 20 char hike (4%, char pops arhiehar): maint pi elser ‘hors 0, rintABnterthe string sotatate) bo push (str For(i =O)
F)* ED AREU BOI6AD, Marks ae anc ‘abe ance Aue AnC*DE, ARe-DE, ANC*DEE ADcDEP ACODER "1 ABCHDEE HEStacks and Quewes a Ifan operand is encountered, ie xe 4 Wan operator @ ie 8. Remove the toptme clone ar b Evaluate BOA. Pelement. 6 Ena, nes Que F1B.] Consider ihe fotlowin in intix notation : Imotie expression written E-Asmtcspi@earoen Beams E-ArC Convert the above expression int postfix and prefix notation, Betas BC+ D/msarcen Poste: Boe SC e DAD hy) 4D spec prin a1 04Diry ed mrcened eto Tye on putting the va agp + fain Ds Test saps Sale co BBY, +7+D + Tan tee ppab sys bs wot Ts pant STAs bya Gs DIMA Crab prefiss BON aye G4 D/s+Ty4D TA pec sD/T ed Sipe G+D/T+D . Inecem+d Inet D ine “ ovaluoe ots ‘on putting te wal Bes Te? vet SD = +9" 107 DTD 2 eARC/D + BD fey +yancsD +B acd BeAmaC+DtB-ATC Postfix: B=A/T, +DB-A*C De B-ATe amet Ae net, “TT Te On putting te Values of Pe TT y- At DE * + AC ARC. DEY ACe AM AC +D*E-ASC AIT, sD°B-ArG -T+D°B-a*C ate -ANc #7, = 1-1 On puting the values af Ps 2-12, 2-437 AcSLACCSIT Sem) Stacks ad Quevee S7an,* Dee Ae FeTIC] Soe the tattoring 2 WA-G54 0) *D)/G+ F) Lat to post) Bsmt) ative preted Toker 15-1 ftvatuate ene given posthicemprecsiont =a] (a-as + ODN +) (as CrDyEP+ 2 Wa-18 6000 HA geH)*D 0) asc pire cA -gp-9/ x) os caer) qae-ysxs any rns, ax! [Now put the vals Az BPE “Tina the required posts frm. (eB) 440-4 -E (an) +*C-1D- BaP cae et C-- BaP XotC-e DEAF Ketc-warh XetC~ (aR, eB x+nc-2) xP ow pat the valet wr ean= ce SiTancene ottab—ca—par Fans cxpreeston ir eonverted into inf expression 295 5 Ea rig cand aioe 2h 418 igo3) uit 8) ce By a8) 1. 6.inerted + occurred + ooerred Was (23) Aloserted Linterted Sinsrted occured Foceunred a| ~eccurred een, thewatue 80216A (CSTTSem-3) (PaRTa] oration and Recursion, Principles of Recursion, Toit Recursion, Removal of Recursion Problem Solving Using lerationerad Stacks and Quevee Recursion with Examples such as Binary Search, Fibonaces Number ‘and Hanoi Towers, Trade of between Heration and Recursion. Questions-Answers Loni Answer Type and Medium Answer Type Questions What is oration ? Explain, Quezas. 1. Iteration i the repetition ofa process in ander to gener unbounded) sequence of outcomes 2 Thrsequence wil approach some end point or end value Rach ropottion af the process sa single iteration. and te result ofeach eration isthen the starting prin of tho next iterator 4. eration allows us to simplify our algorithm hy stating shat we will opwat certain steps unt ld 1 «This makes designing algorithms quicker and simpler because they a include ls of unnecessary steps js wed in computer programs to repeats of i repeat aset ofinstructins utes specie ofc ieration wil repeat the 6 Rerat 1. Gaunt eontesledstoration will umber af times, while condition co Titructions until a sei condition is met BAG. What fs recursion ? Explain. 1 Reewionisa process of stecicapertion 2 adic eeursion aceurs whem one Function calls noth thon eallthe iat anetion. 4. Suppose Pina proces containing it atallstatement te ascend procedare that Callstacment hack othe orginal precetiure P. the prt afore ‘expressing function that ellstet nent titeelfor 4 Then Piscalled recursive procedure totum indefinitely. 2. ‘Thee nur be eetain rite, called be ritra, or which Procedure docs call elt Bich time the procedure dace cll tal est be eher a the 6 Arcunive ms eo 1. Similarly, «function i su to be recursively defined the ont Skintion refers ete |i, in onder fo the definition motto be ier, mA ave the ‘owing oe ropertcn There must nccertain argument, called age vale, whch the feelin deena fers el 1, Bach tine the foneton doce refer to itsef the srmoeont oth Feet must be sero. base vale, Gee] What is recursion ? Write a recursive program to find sum of digits of the given number. Alto, ealewlote ¢he time TARTU 2016-17, tecursion leer Q 2.16, Page 2-16N, Unit Program t ina<10) eeu 10 + sum 100; cnimeda priate of digits ©‘Time complexity: aun tt ‘ treo toro eT fatale 2:10 tay 1 Sewecnnedndie that tinmransey Le lenath ofthe dist the np maemo 4 Sostimecomplentyigg ME ‘BU = OUoagth af dig oF eau tt of i wher athe nut whe som of 200238; ] Explain at Ges or sccursion with w Answer ‘Types ot recursion | Direct recursion +A fnetion discal Direetreeurdon Aiesty ecutive containg an Fete an = ' 1b, Indirect recursion: A neti ie nivety cue ‘all toanothor ontion For example Ine ct Titie= 0) Feuen bar r Inca tiny) return fy = 15 & Tall recursion : fC seanaina a 1, Tallreeursian{or ta-endeseursion is special cave ofrccuraion in Which the Tost operation af tke Gneton, th tal calles rncurivg ‘al. Sush reunions can be aly tranloroe te erations, 2 Replacing ecursinn with iteration, man drastically decrenne 3. Converting call oa brinch arjump in such cas sealed tit call optimization, For example Consider this recursive: Factorial inh yo automation he eoount of atack space eed and improve Fvition ofthe factorial funetin in Totus m1 : i = 4. Ta tnt tat rocuive nse ous eal tara i tsa thing the uneunnGita ena hasta be mip by ino) elu seaman stam factralén 0? aeeumtar, otra fetal =D ea and tree recursive t 1. Arseurese funn ind oe neanly recursive when no pending ‘ration invelwes another recursive cal tthe aneian 2 Acousive fection i aid tobe tro rosursive (or nea linearly Teourtvel when the pending operation doce Snvelve snather ‘he Monod faction fs provides saat example of tree recursion "The Fitopsce! nome can ba dina bythe rule Youn ines) Wie =0) iia b ‘return fib in—1) + fib (a2) r ‘The ponding operation or the oeursvecalli another cll ta 8h Therefore, ‘QueBA9- | Explain Tower of Hanot “Anewer 4 Suppose theee pops abled A,B ad Cis given, and suppose on pe A, there are ite number efx dake with dereasing sce Ths objoct ofthe yoo ta move the disks from pe A to peg C using peg Basan ailiay7 ee ‘ne time con lange di epee on sale ds / I ars total umber of tap to Sere ‘GaeZO.] What is Tower of Hanot problem code in C language far the problem. Tnewer ‘Tower of Hane! problem :Refor@. 219, Pe 2-108, Uns Recursive code for Tower of Hanoi: finetude
void maint ces and ewes eda time peony tits three char a8 BU! Sarre nt, ebo har, eae prinenter napber of ok anf") caer Tair of avo prob wil al ihe printaeequonee i 8" Taot As B, Ox print 1 vid anoint ache A, che B eae ©) C henos 91. B prin Mowe dik i rom Sto ea 8, AC. ‘QacBai] Write 9 reourstow algorithm for sotving the probten ‘Tower of Mano! and alse explain fe» complexity. Mlusteate Explain Tower of Hanei problem snd write a recursive algori Write gu algorithm for finding solution to the 7% (tone! problem Explain the wording of your algorithm ( ‘lac with dingeams. iaewer ‘Tower of Hanel problem : Hofer Q.2.19, Page 2-198, Unit2se2Qcsrsema) Stacks ant Queer This prone vera recurive sla Nala vlnion nt Power of Hane’ prablem fo a Woite: BEG + BND, Be Return r 2 (Move N—1 dick from peg BEG to Pee BEG to peg AUX Call TOWERIN- 2, BEC, END, AUS 8. Write: BEG —+ END 4. [Move N— 1 disk from peg AUX to peg END) (Gal TOWERIN=1, AUS, REG, END) 4 5 Recurn : ‘Time complexity : Let the time required form diss is Ti. nde If structure} "There are 2 recursive calls for 1 disks and one constant tans operation to mova a disk fom rony poe to topes Lett bo “Therefore. " Tn) = 278-4 &, ‘T)= ky, a constant, aah, Taha ah, = yr, b= lg thy By + CCootiient of fy = 2 Cocticent of k= 2 “Time complexity is O12" or Ola) whore isa constant greater than 1 So, thas expocential Hine complexity: Space complexity : Secor force inept ota te Tien we do the 2° recursive cal 1 neers calls aver. So, we ean reuse The space of eal oe Beall Home, Ty= Tee no=k m ma) = 3b Ta) = ae So, the space complenity is 01. oto Structure ‘Numerical Fag 221, on Tins echeratie tiarration ofthe Maer Obie A,B, O08 dike. 3 PKS) TOWERG.A.C. ge ‘TOWER, ATLA Cone TOWER, BAO BO [TOWER (3, A,6,B{ =A Ben wer s TOWER (1.6.2, Mar OA poweR ,C.8, 576-4 Bane nnn 9B oon FEWER A.A CB AB ease TOWER 4 A,B,C} 8 Cnn Ka BSe TOWER 1, B,A,€) —— BPC nines FowERG. AC.» ‘TOWERE, 4,8, ——A > 6. — POWER, B.A.O~. ig: 214, Rese hilo bo Toner of ant problem fora = & ‘owerve tha the sseursve aolution farn = 4 disks consist ofthe following Pc Bac ASB CHA CB AGB ASE BG BIR OLA BCA DBASE BG ‘GaeEE | Discuss the principle of recursion. Rawer 2 Terurtcn ie nplemented through the use of function, is fonction thet contoins »fanetion all wo itself er a fonction call to = 2gandfoneton wnich eventually ella the first function, is OWN BS 8 recursive hnetion. "Two important conditions ras be satisfied by any recursive function = 1 Bach time a funtion ell itself must be eloser, in some sense to stelation bb Tore mut be «discussion erterion fr stopping the process or ‘computationSBALewiTsemay S°EEE | thew recurston con be removed? There are two ways 2 By using stack +All nomtail rcurion mati canbe eened Recursion Hofer. 216, gu 218A, Unit peg ne lartorial ofa given number winzseeesion se aka given number using monrecarsin ie revwrert, i fee 1 rotors, queues: Operation on Queus Create, Ade Delete, ‘QuortionsAnewers [ fans Anos Bee and Meaiua newer type Quetione toma posrti whi natn ent oneforsnterton ooo SDT Taree dw ser to th que ponk) oF Bnet Dent forramore) an clement fom que (pp) or Denon tet220 \CSATSem) Stocks and ae ‘GuedBE] Write the procedures for insertion, deletion and traversal of que: [ARTO BOTS, Wark 05 on Discuss various algorithm for Various aperation of quewe. Tawer {tert (Queue bax Fron, Rea Bloment) ear ld te ine of to nt lament of Queue repee Display "Overllw=and Retoa Ston2: If
Tre avait AVAIL LINEC(AVATL? Boao Repent stp wa LINK (CPT) 1= FIRST cere LkKWaeD HINRICH PER nik isis OVERFLOW and STOP TINK (cen erst poe sua iat OVERFLOW and STOP S. stor fecberinning 1 a Tnkel tnt is UNDERELOW al STOP. : ist Bea mut we LINK (COT FST 2) Greuniccrn 3 pre rissr rns « LINECPTR) ENG: FIST 6 intern aval vale PTR STOP i From te and From oe eo. hen lnk let's UNDERELOW and STOP. 2 a inst Gere UNK CPD: 5. TING FIRST § Unie Savan valle CPP 1_S1oP Guedde] Write a C progeam to implement the array representation of eicular quote Tawwer | sinclnecstdin b> Jrnclaecprsent > define sae 18 - reseteteuct ete. rears intent AKI: Myeoue eid et areqase (queue “2 | See oat > roar , ft eompty faves 28) son > front == 0) rotarnd220A (C8 Som- MAX ‘ stun 0, ag front Javan | simone fanP =a > cement tag» tot a> font = Es (q-> font +2) 5 ax. photon void maine t Sint ore write aye brant" insertion x Drintt-2:Deteten Dain, Bat printBoter sour choice) 2 Seanitma cy soe hy t cnc ‘Risa aay Hl DrintfCguone ly; otehoy i tse t DrintfEinter wale" BSLALCEMTem 3) iene tn Pet guane amply echt PrintfValucdeloted ia dete); acho ‘GeaESO, | weitea program to implement qnowe usinglinked lat, Rae ‘feces ‘tect Hecadecsutiae t inti eae ks k rvstaade font, *reae oid min i tect old inter), delete), eplayt s ines whe a) t pent" tase" Deine. Dedetetais Pens Dupe; prin Exit PrN Bator your eee Scant, chy,282A (CST Seim-9) Stacks and Queue vevitchichs C real cave? late ieplay break “ext ferauit ‘rinth*Please enter corest chaice Va" 1 fete 1 ' 0 copa von Dprinuftelnput the element for inseeting \A"% ater Prrslinle NULL: TRizent == NULL aque inempty* void deere ‘ struct node “ptr if front == NULL print 1“Quewe fe andertine 86 , Jf thront == Fea ata Structure Freettron rear NULL one pte= front ‘ont ptr tink: froo per: ' , vid iaplayt) ‘ steuer nade "pte; ont == NULL) print’ Queue ic empty ah see print*\n tlontenta inthe Quewe area" svhilegptel= NULLD ’ “ - ' ‘QeeBa | Heptain how actreular queno can be plemented ws serays, Write all funetions for circular queue operations, ‘Answer : iserentea rinse tenes egestas Fonetion te oreate cirewlar qucwe: eld ces ended woe4A SITS Starks ond Queues iFdiront -=0 Bee rear oe r i ike 1) Iman = Prat eGQiovcig Fury ~ sce <1) i se front == 1)" Insert First Element ‘ ment) frre val “Fae TRE | Eaatain dequete with tyes, ; : . Pra tantric pratt peel Cher ond of the quowos That ie, we ean knsert on elemons Some meen Sher end or the front end. Aloo deletion ix possiie fro m= 7 v iia ) eee Tee ! Pig, 2.82: Siructire af deaueve. i sre deqocue ean be wd beth a atk nea ee [Funclian'te disiota elomnoit from elivilai qatiiy # sae ye py tach this dequens eanerepeesentod Te freee nee 5 mecsemmlenaer urentaeopentimne Seront Penge dunt ke it ce b Sagres ‘taunts scotteen — Feu INT MN Pnpeereniccd doquese:Tningst- rected deur, coment ht " i HomaheTatoniyonsesobat we con delete Shere etait 2 Outpubrentricted dequeue : Ap ouiputreniied deannue 8 iro Goyoeus whure deletions take place atonly oneend bat allows insertion Fiera ome i rs : Wp sea douse Prent ; S— tosertion enue datas ncertion , Selene Th Oupar raed dequrwe wig 2822 Dequeus and Priority Quewe.QoeHTS.| What do you mean ty pelestyy queue ? Decee! plleations omer] SSSR mera aes inode emt eatty acres ‘Tao elomente with te sme ririy ao proceed othe oe in ‘Type of prictty wueuce are SUE menting ry ao lesen sading priority ewe dexeuiy ty duce, le In'Riealston modeling sansge th ero events he wey ‘VERY IMPORTANT QUESTIONS Ting questa are wor fnportan. These gursions| eee ee Bracket in ‘your SESSIONALS ass well as Giivansery mxAMNAatioN. 0.1 ete 6 ameton oars Ana Held 2 ae es a an, Write a6 faction fe Beer 28 wh esta? rplermont stack with sl ink har 26 eer 20, inv semcke A+ (B® C(O" By Fawr" D TE’ em nts toporene USS wnSe- tb A49 5 nto pein) ea 7~ tcaae the given posts expression) Reser 28, Bete Gah eter 820 " lain Tower of Hanol problem and write a recurs ieerg aa Donirecuraive program tovaletate tho Tac il af he Rera 296,2NAUCSIT Sem) Refer. 3 neces unr Sorting G14 Weite 2.6 program to fmplement Metre ro Wout the array representation ane Reler@. 235 2.35 Explain how a cireutar queue eam be implemented using arrays. Write all fanctlons for circular queue operations? ‘Aue Refer. 231 " overstons 280 CONTEN’ TS SI Ateursem)ad “Long Answer Type and Medium Anewer Type Questions Que] What do you mean by searching ? Explain “Answer |] EEechiewi the proce tang te ecto von lament inthe 2 Thowireh ts aaid to i sess if the given loan fond che lent dace exist athe array therwineunauccefal There are gw cenrthing techniques 2." Linear seoreh eoquentiall Binary search 4 The algorithm which we shoore dopends on organeation af The aig topes oor ertne array 5th cements are ia random ardor, hen We havo tous linear search technique, andthe aay clemente ar srte. ten preferable to ‘rebunary search. Qaeda. ] Write « short note om sequential seurch and index | sequential search. ‘Answer Sequential seare! 1 "Ip scquentil or linea) seorch, each element of an array is read ome by-one sequently ail fe compared with the desi element. A Search willbe unsuecesaflifalJthe clomonts aro read and the desired element ie found. Tinoer search isthe least officant search techniques. Itisuand when the recorde sre stored wethout considering the order oF ‘Whien the storage msdn lacks the diect access facility Tis the simplest ay for finding element ina lst [searches the lomenta sequentially alist nomatier whother list. sorted or uncorted 1 aac of sorted Ist in ascondiag order, the search isstartod from svelement asd continued wnt dosired element s ound or the dicmont sliose value io greater than the value boing searched, echniqu mong other sear | bata Steuctore _ dnceening oder, the sense tao eine nel Une desires meat a date at alert value Beng STIs umurted seorchiog started fom Ist 1 at the clement foundor the end tthe tes cet earch, om index ile fereate. tha oo aes ar dvian af roauired roca, ence ander spect rot Tcarehing of clement be done which is Spestica dru. >. TENSE Scquenta enrch a sorted index is ect aiden Brchetement in the index point tuathor expand inex “Sod that guides the search inthe aeay shoes de indexing multiple tnestibe te indeeat an inde Caan ae nket a request x peciic records twit a that espitet where tha specific racora is recorded, Foess. | Write down algorithm for Hinear/sequential technique, Give ts analysts bh tnconeafsarted iat 1 tabla of elements nthe 4. Fiurshe index in ea 5 Indexed nequentia wea “newer LINEAR(DATA.N, ITEM. LOO) HRC DATA tealigcar array with W elements, and ITER is 2 given’ Bere ilun.Tuisalgorithin finde the location LOC oF ITEM DATA. oF TOO. = 04 the eoare i wnsuccessl PS cra IMM a the en of DATA] Set DATAL'¢ 11 2=TTEM 2 Unites counter Set LOC = 1 § Weurehfor TEM Repeat while DATAILOC) 1TEM ‘Ser LOC = LOC 1 tendon) 44 ESaccestul LOG WV +4, thom Set LOC 5 Est Analyt ‘ost ease: Worstense Element oceur atk bas Ta_| Weite down the algorithm of binary search techni ite down the complexity of algorithm. of near earch: clement eocur a est position Time eompesity is 1). ast position. nme complexity sO. ‘Anewer inary soarch (A, n, item, 1oe) ‘ [Luv fran array f'n numberof tems, item is value tobe seerched
You might also like
Cloud Computing Quantum Koe 081
PDF
100% (1)
Cloud Computing Quantum Koe 081
79 pages
Quantum COA
PDF
88% (17)
Quantum COA
293 pages
Compiler Design Quantum PDF
PDF
100% (1)
Compiler Design Quantum PDF
211 pages
Mathematics 4 Quantum More at QuantumSupply
PDF
100% (2)
Mathematics 4 Quantum More at QuantumSupply
82 pages
Python Quantum
PDF
78% (9)
Python Quantum
194 pages
TAFL Quantum
PDF
100% (2)
TAFL Quantum
78 pages
Theory of Automata and Formal Languages
PDF
0% (1)
Theory of Automata and Formal Languages
79 pages
Software Engineering Quantum
PDF
50% (2)
Software Engineering Quantum
85 pages
DS 2nd Yr. Quantum ? 2023-24
PDF
100% (1)
DS 2nd Yr. Quantum ? 2023-24
121 pages
Operating System Quantum Book For Aktu Students
PDF
100% (6)
Operating System Quantum Book For Aktu Students
96 pages
Design and Analysis of Algorithm Quantum
PDF
100% (14)
Design and Analysis of Algorithm Quantum
359 pages
Mobile Computing Quantum (Motivationbank - In)
PDF
50% (2)
Mobile Computing Quantum (Motivationbank - In)
97 pages
SE (KCS-601) Unit-1 Notes
PDF
No ratings yet
SE (KCS-601) Unit-1 Notes
16 pages
Aktu Computer Network Quantum Rotated 6th Sem
PDF
50% (4)
Aktu Computer Network Quantum Rotated 6th Sem
84 pages
AI Quantum
PDF
0% (1)
AI Quantum
58 pages
Soft Computing Quantum
PDF
80% (5)
Soft Computing Quantum
84 pages
Universal Human Values Quantum
PDF
50% (2)
Universal Human Values Quantum
107 pages
Data Structure Quantum Series-1
PDF
0% (1)
Data Structure Quantum Series-1
127 pages
DSTL Quantum
PDF
No ratings yet
DSTL Quantum
134 pages
Quantum - Cloud Computing
PDF
100% (4)
Quantum - Cloud Computing
89 pages
OOSD Quantum (Unit 2,3,4,5)
PDF
67% (3)
OOSD Quantum (Unit 2,3,4,5)
136 pages
SPM Latest Quantum
PDF
No ratings yet
SPM Latest Quantum
91 pages
Data Compression Quantum
PDF
100% (1)
Data Compression Quantum
82 pages
Digital Electrons Quantum 4th Sem
PDF
100% (1)
Digital Electrons Quantum 4th Sem
122 pages
Engineering Mathematics 1 Quantum
PDF
No ratings yet
Engineering Mathematics 1 Quantum
81 pages
Quantum Design and Analysis of Algorithms Full PDF
PDF
100% (1)
Quantum Design and Analysis of Algorithms Full PDF
196 pages
Unit 1 DBMS Aktu Notes
PDF
100% (1)
Unit 1 DBMS Aktu Notes
21 pages
Computer Graphics Quantum
PDF
No ratings yet
Computer Graphics Quantum
74 pages
Software Engineering Quantum
PDF
86% (7)
Software Engineering Quantum
85 pages
Compiler Design Quantum For AKTU
PDF
67% (9)
Compiler Design Quantum For AKTU
78 pages
Software Testing Aktu
PDF
0% (1)
Software Testing Aktu
106 pages
Big Data Quantum
PDF
100% (1)
Big Data Quantum
78 pages
Computer System Security Quantum
PDF
100% (2)
Computer System Security Quantum
158 pages
Hci Quantum
PDF
67% (3)
Hci Quantum
63 pages
DSTL Quantum PDF by Motivation Bank
PDF
100% (1)
DSTL Quantum PDF by Motivation Bank
259 pages
Cloud Computing All Unit More at QuantumSupply
PDF
100% (5)
Cloud Computing All Unit More at QuantumSupply
89 pages
Technical Communication Quantum
PDF
67% (6)
Technical Communication Quantum
247 pages
Cyber Security Full Quantum
PDF
50% (4)
Cyber Security Full Quantum
66 pages
DSTL Quantum
PDF
50% (2)
DSTL Quantum
258 pages
Database Management Quantum Seb
PDF
50% (4)
Database Management Quantum Seb
284 pages
Math IV Quantum (Aktu)
PDF
No ratings yet
Math IV Quantum (Aktu)
147 pages
DAA Quantum PDF
PDF
62% (26)
DAA Quantum PDF
111 pages
Unit-3 Notes Oosd
PDF
0% (1)
Unit-3 Notes Oosd
20 pages
IT8075-UNIT-5-Best-methods-of-staff-selection-Motivation SPM
PDF
No ratings yet
IT8075-UNIT-5-Best-methods-of-staff-selection-Motivation SPM
35 pages
Software Project Management Unit-5 - 4 PDF
PDF
No ratings yet
Software Project Management Unit-5 - 4 PDF
2 pages
Dbms Quantum
PDF
87% (23)
Dbms Quantum
97 pages
Quantum Web Technology Kcs 602
PDF
No ratings yet
Quantum Web Technology Kcs 602
338 pages
Artificial Intelligence KCS - 071 (7TH)
PDF
100% (5)
Artificial Intelligence KCS - 071 (7TH)
60 pages
Ai Previous Year Question Paper Aktu
PDF
100% (1)
Ai Previous Year Question Paper Aktu
11 pages
Daa Unit 1 Notes
PDF
67% (3)
Daa Unit 1 Notes
67 pages
Compiler Design Quantum
PDF
100% (1)
Compiler Design Quantum
89 pages
Artificial Intelligence KCS - 071 (7TH)
PDF
100% (1)
Artificial Intelligence KCS - 071 (7TH)
60 pages
Data Structure Quantum Series
PDF
No ratings yet
Data Structure Quantum Series
127 pages
DS Part1 Merged Compressed
PDF
No ratings yet
DS Part1 Merged Compressed
212 pages
Asymptotic Notation
PDF
No ratings yet
Asymptotic Notation
3 pages
Introduction
PDF
No ratings yet
Introduction
11 pages
Data Structures and Algorithms Made Easy - Narasimha Karumanchi
PDF
76% (25)
Data Structures and Algorithms Made Easy - Narasimha Karumanchi
214 pages
Data Structures Basic Programs
PDF
No ratings yet
Data Structures Basic Programs
132 pages
Whole Dsa Notes Made by Me
PDF
100% (1)
Whole Dsa Notes Made by Me
411 pages
Lecture - Asymptotic Complexity and Abstract Data Types
PDF
No ratings yet
Lecture - Asymptotic Complexity and Abstract Data Types
35 pages