Address
:
[go:
up one dir
,
main page
]
Include Form
Remove Scripts
Session Cookies
Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
40 views
25 pages
DSL 3 Unit Full
DSL 3 unit full
Uploaded by
omsingh300710
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 DSL 3 unit full For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
40 views
25 pages
DSL 3 Unit Full
DSL 3 unit full
Uploaded by
omsingh300710
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 DSL 3 unit full For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 25
Search
Fullscreen
ned tee TM pe = Linked. list isa linear alate. tructure awh A _CHlection of data elements or pies = Successive elements jn LL are — -Lnihe | by pointer and the last het Sleiay int to ‘null.” aa t= rere Je a specia) node called ‘head’ < | b fstart? node which always pants te | AP the fist: é | Head /atart | E. I Peele x Bo 4o- * Basie terms jn Le: Bes Node ele. in LLis called node. as = Ne. consists OF 2 parts. first fame tS info-/data part & second part js neato’ |__ pointer part - ! : —Page No| NULL inter: -When' the Le js emp or nd, node in tt , then ee Os ™ EM Nutt value is sel 1d pointer. jre [PTR= MULL] f ed Empty list: - Wien there is no node ina linked ist» then \t__ \ js c/a etn Jinked lish? \ Dvartages eee Lier \ \ Linted V Nist provides as ae +o jnsert Brel i, delete nodes a oe User can increase or Y decrease the size of list a i Maser or Bee a node. Linked] list follows an efPiclent memory aillecation | BE Geh as vidites Aqtaiars not MWVieoneemie contjgiou.s memory location like an: array. Here’ nodes Vare Stored random) Thats why it re duce the was f jemory -space. 1 =a Cal Ne need to pre- define the size of Jinked lFineertion. ane deletion is ee optimal in Jinked Jist: Unlike an array , we neeel not shift or chang | : the position of an¥ item,ry allocation: LMA _W eqn aljocite 4 memor LD State 0: v = Mlemor: Is jg allocated eluxin compile +ime can't (allocate and _cleallecate ‘memory eluring execution . Ef | — Here, Stack date structure js nites i Static MA is less efficient than ofynesnlc A _ Memo e | ei 04 amie MA: | = Timer is abt at runtime : Allocatton cind de- allocation can be Toe using ‘stlibsh - ad allocates memory from heap ° So that it brary function _o{Date J cocci ce + Ubrary Functions ofor meniorg alloation : ih a: Majjoe CMA) malloc CY) = It allocate single blek of | requested mertory of Specified mae = : i Suntan = void * mMdlloe Csize ) J Here, size > block size 4 eee eet = Cine) malloc (6xsize4 Cint)) for nas Senin yore eo bate i TE 2c bye available | 2+ Calloce (continous allocgthon ) caivecc> — I+ performs same operation like malloc bat 5 differene js that it initializes each black with elefault value zero penne -T+ has 2 parameters as compared to malloc. Santen ss wal * cajloc (omeieen) -ptr= Lint * ) calloe Cn, eizeOf Cint) ) > e-4 =! 5yy —> 4 bufesforit LAL Als 1A 3. Free function >freec ) It is used te de-allocate memory space which is allocated by malloc & callocy funetion. - Malloc and calloc function are unable +0 de-all memory by their own ~ Whenever de-allecation js done by using fre it helps to reduce wa op mr free} .cleat free Lint ie —— oo pire Cio * Dicalloe Caslelz2OF Cin ) Sreleased J] 4 Realloc 2af6 change memory allocation of Previously Memory Pealloc fuietlen | Is used — = ae memory allocated by alloc ane maloc function {5 insubficiend then realloc function js used to reallocate menor Aynamical)y. Syntan na ptr realloc Cptr, newsize)s = ae = mae Pere reathoe (| Memory representation using LL: i - List ele. dre store arbitary order - Ana rep” ives sto data; \ but LL uses an layout to__store the lata.* | Garbage collection : | We can maintain linked list in memory by assumin ithe possibilities of inserting new node inte the list: | For that we. Wank some memory space se that we can | inserE new nede in the fieeaea 4 | Alse if _we want +o delele any node frm list» then that memory Space is ysed fo future purpose So, theve js q Special Space in aq niemon which a consis of unused memory cell which is call “ available s Space.” ¥ n(a rc See e__+technig collect 1)_deleted 2p pace into ree storaye list js called as “ PMTPRE rhage coljectjon. takes place in sug way Habe irst " computer runs through all the list, markin al\_the cel) those are turrenty used so dala [marks the free Space in the ~ memo _. Overflow : eri RS = When new data \e sere nto the fist + but _ there js no available space ie free Storane listts expt then‘ overflod ’ occurs -We an handle this situation ba adeling the space when we ’re woor king with lata uctyre Underf low: Sle When we want to delete aT data from the list and _ the Ilet jc empty the ‘situation is called as ‘underflow’ ee oh [inked list: raversing : - To couht the number of elements: ac nead Lo Lys] 4-14 Jo 20 20 30 30 49 PIR= start ilips. ia fT = 42 EY SInfObPtR] =A. ting Fre > ana TRI eitthi for +traversin Ai Seb pres ster jen Repeat step 2 & 4 ynti) PIE ANU 3: APPLY PROCESS To anNFoLrereg Step: Set Pre > LINK leTRI al Steps: Bit Searchin Be L Saran le ls used) to find out the Joca-ti on the node where item First ap pear in list . 4 Unsorted list - C = leb> we've o list 5 bub the data in fel list iat mot sorted & If we want to search any parkigular: element in the Jist , then we? ve te traverse in a list using pointer variable ae fleorithm : a Seatch (INFO, Next, ptr) a Step £3. Seb prs Start : ei Step 2 Repeat Steps until pte ¢nuw 4 If stew > INFO [Ptr] then Set (ae Link Cet].Unsorted list 43 oi 2Seb per owe | 2. car * Sorted list - ae__A)aorj}thw : Search CINFO, Next, Ptr) Step 4° Sof Ptr= Start Shep 2: Repest step 8 til) Ptrl= NULL Step 3: if zen. 222 INFO C peas see toc] Prep else Pees cbink: DPEr) vekep +: ExitBEthsertion. —“Insettion” refers to: the eration of als element in the existing linked list. “ = Insertion of new elemént jin the list a Ne, Pa @ ways.-@ In the oe ot list U @ At the given pes @® he the Yast position Insertien in Sorted het Start es peel a Fee eimai: Head—r fw => e ae? for 20 30 S° 4o sper Avai) Me nv pweds | ead Frew t 7q ae ae a > =) x i =a " oe aso 7 280 oo X 1 Arar Hate FAver{] : = Je insert the new element ints the existin Po} ou} a Sains should be alone - f e SDMNEating AS ew node for neo clement fon the abkilable list - 2 fissignin data a new element . ed 3) file ¢ the goiter:a Th Maonthm : srk be (Info, New ,ttem, Link, Avail, start) oil 5 Step 4: if start = NULL then exit Step 2: if pvail=Nurt then overflow octure and exit \ Step B: Set Avai|- New \ \ ae Set Avaj) = link LAvail] Ss 4: Set info L New] = them Step 5: Link [New] = Head 6: Head- New >? Exit Peeudocod e : t Snsert+ _ beg Cstruct node” Head , intdata) i Ee Struct node * new = || I new = (struct node) malloc (size OF (struct node) ) | new —>clata= stem how —> Next = Hedd Head = new 7 i Return Head<< Jove 2200, 2000 Bove t | visting item sass. 5 | neu item + a6 hae F 2% Pier we (Head, Link» nto ) | Step 4 Avail = NULL | write overland exit Step 2: set nea Avat | and Avai\ = Link Cavasi] go: Se Infol Naw] - them yStep 4 iF LOC=NULL then ° Set Link ENew] = Head and Head . New else Link E New) = tink [L0cq : Link L101 - Naw cles Exit-Scr Me Deletion! \refdrs 461 ye operation piremovina lal nade N ee ie | | Deletion can be lone in @ ways i- i) Delete a node from the 4st pos”. D node | from the ven oc”. last noele from the list’ \ \ \ \ \ \ \ N Pseurdocod 2 > ie del_1** Cstruet_node* head) i Sc! Struct node* ptr 5 if (head -~ Nutr) i i A inet eddy Aeai) | Prarie sre js eu DS Zoo = Avai| i 4 ~ Avai| - ; elee’ = Loe ie ae ( ead = heasd > next) -200 } = Tree (p41); = relum head.Sa st Algorithm: ; Algo - pel 4st ( Info, ptt a step 4: jp head = NYLL ‘ write. underflow and ask Step>- Seb _ptr= head Sepa, Sok ead = Linkt head J Step 4: bok Cloe1/Lhead] = ULL Avail Ava\le Loe Steps: Exik ac Pseuqocede + del. last_C struct node , * 7 head) struct snole* teem pb, * prev if a NUD f ae List iis emp mB) else pb (hend—> next> Nur) A t freeChead eas POL fas ony tert head = NULLstep 2: Set ip Vink [head] NULL ; link Dhead] = Avail © head = Nuje ares set ptt = head 3 7 Repeat Step Ss urd} fink Eptr) fone Set prev = pir Seb pir = link Cptr] Set fink rev] = -Nubb link pares Avail Avaj} = Loe Exiteee — Copy | clone single psorplerity ee ao sco mplenily oun) GA eta sie eee . linked list: > |. Here, we? ve. “he “dea) with two polivers = one ts “nexpy ae which pei fo the next element in te 7 random ? pointer which points te any node j in I jenna st a cloning the LL, jt takes O(n) time . ; pointer: pins ts the next node is Bea ee haven 't 238540 a add” 40 _randém Poiter. a a, sian te follow sume sLl i e next po; ext nede _ ii ow. 4 >) ohh je a anata ele inom to Yas abs Toop node b of original liek. es nip { ootolog: AB ARE Ven ow, rovide the link to random pojpter, we U: the stmt. ' = Clone—> r= clne—>r—>r nex oat. For aach node in 4 Sepied Ee al held , Bee @ Consider, Pade. a. from scape a Mmnananeteteh the address of node ain " original wLL- Ww 2 Or = are Se next rine CspandS te net F cle 7H “Randora pointer of nofe a in orjginal LL held the add" of c | then the next of & held the add° i ode c from Clone LL. «- dene of @ hold add’oP eines |@_ consider , node b frem copied LL which held ey eat add” of node b in oy incu} BLS bares 2 OF" wae bore br > a— next ane ow Random pointer of node b in ont ina) lined fist, e, thelds the add’ of a, then the next of « hold the Tot node a trom clone LL-® Consider node c from coppied Li which hold gow PF h bstd a address of node c¢ jn orjainal LL- er = cre > next Random painter) oF node < in origina LL_ hold! 4am Betesenet 2 dithenithe Next of e hold the adder of node e frm clone LL- @ consider, node qd from copied LL which hole the_| address of node ids in original LL- ae gtd dare dS Fle next = Random pointer of nede_q in original LL hold’ laddh of co then! the neat of © held the addres oF node ¢ from clone LL.© Coneider node e from copied LL which hold the address of node e in a ‘original Be emr - 2 Shp, Saeoneee Random pointer of mde e in original LL held the address of 4 then the neat ‘of _d held the Address of node d trem clone LL- Head ea] EEE a ae Jd} ela el% Elle G elsPik etre oN Ste ee rel Ele fic So 2 ; vay Prev. = Bek i (eV = 40] ‘Head = oar : bi SH = 40 > next Pee 4 eh ae Curr = ak / wor EAS te ae + Nabe ot Curr —> next = Prev 7 Le im) Head = Head—snext 20—> next a. ws | | os[baa , A @neatenation of linked list: N ~~ © Gnewtenation of aigle LL’? means append Men new jist = they etlistne list: N Head - li + 4 nN N A 4fe] —e c [ x ‘ to 20. 20 80 «35 Yo XY Head y 2 . [x] f l | Algorithm + i “4 N ae then ; weturn Lo y S Glep 2: if la= Nule then ti . seturn 14. 3 | 3 T step 2: Set ptr = head (14) 4; do traversing in list la 6 "Es Arply ae To nfo [P | : set pins head (L»\sei€ ho = print (“List 2 is empty raha while C por —* neve! = ull) i prr= ptr > next Be r Pir —> n ert Sho ¥ a easCee —— a = e eer = aye Jaimople / linear ta “| Tjpes ot linked jist ee 4.| CTreular linked list = - dna sipgle Jick 5 we can move from a poe any. other Vinode in one divection only 3 bE in ciMuular!ulinkedo |isb githe link eld of last node aleoey point ‘Le the head inede-- a - Heres nal) poled \s not presen a ch a See + Operations of cirewlar LL: i : @_| “Traversing: Seat nal DAE Le atort (Same OR single eS) i T c va ® | Searching : Ceame as single LLD @ | Sheertion : — i) Insertion jn the bgjincing. Headb \ Setistart NULL then exit if avail = Null then overflow oceyrs and exit Set avail= NEw set aval] = linkCavaif] Set link [New] = start start = NEW link C Lest _] = NEW es here herr hte lise ee rte cre ated: (coe! TT)
You might also like
Data Structures
PDF
No ratings yet
Data Structures
100 pages
Linked List
PDF
No ratings yet
Linked List
55 pages
Lecture 5 - Circular Linked List
PDF
No ratings yet
Lecture 5 - Circular Linked List
21 pages
Singly and Doubly Linked List
PDF
No ratings yet
Singly and Doubly Linked List
72 pages
Week 3
PDF
No ratings yet
Week 3
118 pages
Dsa Linkedlist Chapter
PDF
No ratings yet
Dsa Linkedlist Chapter
20 pages
A Simplified Approach: Data Structures
PDF
No ratings yet
A Simplified Approach: Data Structures
58 pages
Final DS Mod3
PDF
No ratings yet
Final DS Mod3
92 pages
CSC 221 DSA Linked List Single Double Circular 10032023 053401pm
PDF
No ratings yet
CSC 221 DSA Linked List Single Double Circular 10032023 053401pm
78 pages
Chapter 4 Teacher
PDF
No ratings yet
Chapter 4 Teacher
25 pages
Linked List
PDF
No ratings yet
Linked List
46 pages
C & DS Unit - III
PDF
No ratings yet
C & DS Unit - III
48 pages
CB - Linked List
PDF
No ratings yet
CB - Linked List
44 pages
Singly Linked List
PDF
No ratings yet
Singly Linked List
9 pages
5 Lists
PDF
No ratings yet
5 Lists
73 pages
CHAPTER 4 - LINKED LISTSds
PDF
No ratings yet
CHAPTER 4 - LINKED LISTSds
61 pages
Unit 3 - Linked Lists
PDF
No ratings yet
Unit 3 - Linked Lists
92 pages
Linked List Notes
PDF
No ratings yet
Linked List Notes
10 pages
Linked List
PDF
No ratings yet
Linked List
104 pages
English Let's Speak
PDF
No ratings yet
English Let's Speak
38 pages
Linked List Jenny
PDF
No ratings yet
Linked List Jenny
10 pages
05-DS-Linked List-2024
PDF
No ratings yet
05-DS-Linked List-2024
58 pages
Data Structure Linked List Short Note
PDF
No ratings yet
Data Structure Linked List Short Note
22 pages
DSA - Lab7-8 Linked List in C+
PDF
No ratings yet
DSA - Lab7-8 Linked List in C+
11 pages
W9 Linked List
PDF
No ratings yet
W9 Linked List
51 pages
Linked List - Module 3
PDF
No ratings yet
Linked List - Module 3
24 pages
DSA Notes
PDF
No ratings yet
DSA Notes
31 pages
+2 COMPUTER SCIENCE - Data Structures and Operations Youtube Oneshot Notes
PDF
No ratings yet
+2 COMPUTER SCIENCE - Data Structures and Operations Youtube Oneshot Notes
66 pages
2nd Unit Ds 1st Yr
PDF
No ratings yet
2nd Unit Ds 1st Yr
23 pages
Linked List
PDF
No ratings yet
Linked List
20 pages
Unit1 Notes
PDF
No ratings yet
Unit1 Notes
36 pages
Linked Lists
PDF
No ratings yet
Linked Lists
51 pages
Dsa Assign 2
PDF
No ratings yet
Dsa Assign 2
7 pages
Unit IV Linkedlist - Watermark
PDF
No ratings yet
Unit IV Linkedlist - Watermark
19 pages
Experiment 6
PDF
No ratings yet
Experiment 6
9 pages
CS Practical - Compressed
PDF
No ratings yet
CS Practical - Compressed
27 pages
Linked Lists: Avoid The Drawbacks of Fixed Size Arrays With
PDF
No ratings yet
Linked Lists: Avoid The Drawbacks of Fixed Size Arrays With
18 pages
Ds-Linked Lis
PDF
No ratings yet
Ds-Linked Lis
50 pages
Dsa Basic
PDF
No ratings yet
Dsa Basic
23 pages
Data Structure فيرست+سكند2019+فاينل2019+2020
PDF
No ratings yet
Data Structure فيرست+سكند2019+فاينل2019+2020
22 pages
Building Linked Lists With C Your Path To Data Structures
PDF
No ratings yet
Building Linked Lists With C Your Path To Data Structures
20 pages
CH3 1
PDF
No ratings yet
CH3 1
16 pages
Linked Lists
PDF
No ratings yet
Linked Lists
71 pages
TD DList Corr
PDF
No ratings yet
TD DList Corr
6 pages
SY 2023 Pat AIDS 5th April - Compressed
PDF
No ratings yet
SY 2023 Pat AIDS 5th April - Compressed
61 pages
Unit 3
PDF
No ratings yet
Unit 3
56 pages
Programs For Dsu Manual
PDF
No ratings yet
Programs For Dsu Manual
15 pages
DS GTU Study Material E-Notes Unit-4 06092019073913AM
PDF
No ratings yet
DS GTU Study Material E-Notes Unit-4 06092019073913AM
32 pages
DSA Lab Sheet
PDF
No ratings yet
DSA Lab Sheet
33 pages
A2116218693 - 22209 - 31 - 2019 - Chapter 3 Singly Linked Lists
PDF
No ratings yet
A2116218693 - 22209 - 31 - 2019 - Chapter 3 Singly Linked Lists
44 pages
Link List - Data Structure
PDF
No ratings yet
Link List - Data Structure
9 pages
Linked List
PDF
No ratings yet
Linked List
83 pages
Single Linked Lists
PDF
No ratings yet
Single Linked Lists
11 pages
Module 3 Part 1
PDF
No ratings yet
Module 3 Part 1
23 pages
DSA521S-Linked List 3
PDF
No ratings yet
DSA521S-Linked List 3
30 pages
Suraj ? M2 Unit 04 Notes
PDF
No ratings yet
Suraj ? M2 Unit 04 Notes
30 pages
Lecture 5 Linked List Basic
PDF
No ratings yet
Lecture 5 Linked List Basic
16 pages
Unit 4
PDF
No ratings yet
Unit 4
32 pages
Arrayoperation (Insertion, Deletion)
PDF
No ratings yet
Arrayoperation (Insertion, Deletion)
11 pages
Linked List Sample Program
PDF
No ratings yet
Linked List Sample Program
6 pages
Linked List Outline
PDF
No ratings yet
Linked List Outline
17 pages
Linked List Outline
PDF
No ratings yet
Linked List Outline
17 pages
Bonus Lab PDF
PDF
No ratings yet
Bonus Lab PDF
12 pages
4 Linked List
PDF
No ratings yet
4 Linked List
13 pages
SYBtech Sem 3 Endsem Question Papers 2023-24
PDF
No ratings yet
SYBtech Sem 3 Endsem Question Papers 2023-24
10 pages
EXCEPTION READING VERIFICATION LIST 06dec2024
PDF
No ratings yet
EXCEPTION READING VERIFICATION LIST 06dec2024
1 page