0% found this document useful (0 votes)
17 views11 pages

Algorithms of C

Algorithm
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
0% found this document useful (0 votes)
17 views11 pages

Algorithms of C

Algorithm
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
You are on page 1/ 11
BePl> Stosct Step, on italize * CXL O SPOCLUSL Node Sth too MEMBOU 2 dato Cintoga’ pS * Initiolne ped = Nun. toile vou GSPB rene. Re peat Until User Choice Exit(®. first itpay MeN LUISE choices ard Rood use Chof ce Sep Tnsoion opsrasions GOsel? Create ot beofinn’r | 3 Allocoke pnernony for NaN Ode | 2+ Input cots, AMO NINO | 3S Moke Newenut = head 4 Updake Read. = newanode Ss if tai -=NULL thon Sek tail=newnodk DS@r Croats at enol I. Allocate, Memory for newonode 2. Tnpet data into newvnodk 3: Sek Mevdnode-ynext= WULL- 4 44 heod. =NULL Seb both heads tai l= NeONode. S* Else, We toil-ynent=nersnedte Ord ypdatte, toil= nevonode, GOES: Gxdate gk Specitc posttien(pes) 1. Allocate, Memory for o Newnadke “NPL doko Wo the Newnode Sp 2. If POS==| - InSestt at beginning H- Else, LVAvee [St Up tO(pos—f Noole 6. Tf position volid 2 tAsect neste 4n berocen Dy adjusting poPrteu 6. El positon invalid pret Q q QING; sa =p. Disploy list. lif heod == NOLL -Y Print “List em 2. Else, traverse Fyrom head to NULL 3. pryint each node's chta with asv100 =) Geeo> Stop. + C¥eat, 0. SETUGHURE Noda vth t490 dota Ginvegen) Cb neat Cpoimest to nest Nook * Wnitolize head =VULL, toll> NUL SteRB Menu. ; “Repeat be until User Chooses Exile) Bieplay meno with 6 choies.ard Road Use CAbice (hepts- Ts ection agerotion. cases Cyeate ok beginning 1, Alloxot. emory for a Neonode 2. Enput. dota into the neonode 3B. Hoke neonode-ynext =neod 4. = updotr Neodk = Newnode | Vb toil ==nub-, ~the sdk toi | = NINO | GrOpS; Deleon opexohon Casey: eld ot bogincing 1 Ff Nead==NVL- print "List empty”. 2. Else, store heod Intemp, Lpdote head = Neod ~ next « 2. prink delete Clement, free Lemp. uy. Hf head == > ako set toil =u! a Delete at ond 1. | Pead==VU0LLY Pint "List epnpty”. 2 iH only One node -y Peleie Mead * Eat Coch ead BE: p | ear Gorr the list Cgorttise ). : 1. Take +00 Points § Prev and cu 2+ eukorloop 7 MeVe Rad *0end. 3. TANS! loop Yue prey “yMeLk tO end. LAME pfey Adata. > < Usetrdbbow + Susap the 4:00 dato valuos BEEF eine V. FEnpuk number gy odes 2. Col insesxt Noolwist Cn) CSxepy) 3: PANt “Linked List before Sarg -7 COLL disployrist (Sups) Ly. CodL Sorrbist OD (Sree S. pint “Linked List of- tt sorting? Calk dis ploy vist C) (teps) €. Endl ef the pregrem Sep8; Stop ISLE Shosct. i : ie GRP Dekine Gtructune Mode contains dota Grnteges’) ard next (pointer tothe next | Node) } Hees? yi tiahize globo po ines Read = NULL toil = NULL |SRPEY- Trsesds MOde Cinsesct niaautise Cry), \. On puck one Numbeaxd Hadesn. | 2. Rpeok he Same -fox 1=1 tpn, | © A\\ocate TRMOY toy Neonode, wRiereier 4 oUlccosion fey aaa \ * Tnpuk integesi.cotatyom OSes * Sek Mevonodle-y deta cho anol Newonade-y next = NULL | * IF Vist 8s emety Chead == NolL) Rt head = tail newmadte, SEI, Attach the neni ak end (toil next = Nevondole, UP dKO: L011 =NeLMOdLe Hemony rot allecotect” andl Yetusn, | Boe Display Vist Gispoy List). 2. Else, brawsxse From head 40 1 \. Mf Read =- yull + print “List u empty" | t / ve PPP = Print each Mod's code an Sees Seanchard Replace. CSecerch xepace Gon Le Tnpot Seo%ch value n + 2. Initialize flog -f=6. 3 Tromonse linked fist From head toon cif dotasan. sob f=) ASK) USeH for replacement value ol Replace, -y Naoke 4 dotO=d. Retusun. 4. AFH Craxotsou. if £20 4 print" Element not uae TNAINC) 1. Tnpuk Number O Meas 2. Co insed Nady isn) Cetepy ) 3- Print "Linked List befoye. Ne Placermend’ 5 cow. MS play List OL step sd, 4. Inputvaluuro Seoseh aya op lace 5. col Seanch replace Cwlure) (Steps) . 6 PHNE™ LnKed Lid ad-Leoe eplacemerd’. ~> CoM display Hot CD.(Stpsd. | hepa: Stop As: + alia ata eT BLO Initialize, heod.= Nut +0) = NOLL etee¥ eno. Stee5* Create _node_begindd. Algeritinter QL @eokion — N= Stood: ce Oe ; , Define gtructuse nade CoA contain 3 3 cha Cinkegerd, next pointer to next Nod), prey CPortento Prev! BUS Node) , Repeot until Choice = Erut (S) ' Display meno. slexents Mada ot beainning. s»creote. Ode ot end seCyeate node ot Specie potition 24. Display, list oS. Bot 2 Rood USe% choice. = PEOIM OpopatIon accorsirgly a =D-1co Crake Node _ begin), else if (ch= =D¥ colt Clenkee nga anna else \f Ch==3)-+ Input FOS; cate CTeak, —NGde — position(fPod elseif (Ch==4) + colt disploy vec), eke it Ch==5)- priN Exiting. Rise # > pint "amyolid choice. : 1 ANlOcoLe tHemoty 4 ( QS ay baba B.Trput cote. -7 Ossign tO reusnede -ydosto- 4. Sok Newnode-> prey = NULL = S. tt Cheod == Nutt) «Set head =newnoda, tolls newnole Else. ' } Sek newnode next =heod- Sek heod -y prey = rence UpdbKe eod= Newnrade Stepe> Cyeote—node_endC). 1 A\Ocoke memory foy nevonade 2 NF Nevonode = MULL. print " Memory | MOL qNocakeok . 5+ Input doko -y assign tp rewnnde yao. | 4 Sab newnode + next = NULL | &. H hed = = Yul | SH eod. =revanade tafl = neuonode Else. | Sekt tai\-ynext =nenvonedle Sek nevonodl -ypyey = tail. UPA tail = qecanadle Sept creots-Node_ position (Pos) 1 AMOcckL rremony fOr neLonele > \F rewnede == Noll , print ™ Not olocoke™ | 3. Input coto. ~ assign to merenada 4. 1fCPos ==) i Sok New Memory Set heod.-Y prev = Keuanode. Updake Nead= newnooks Yeu: S. Else Trovene JiSt UNE CPas-Dtn nade oC == NUL hon print "PeBition edt of HONK", free noche, petro Else INES Node Hetwan pando PY next = nemode NewdNoda+> Pky = Pp Nevonadeyrent =c. CY Prey = Neumnede SPG> display_visc> V. \fCneod == NULL) -¥ print" isk is ernpty'. ee |S sek temp = heod. wWhile Cteme | =nuLe) Pat temp-ydoko —7 Hove kmp= temp > Next. print NOLL = a

You might also like