The document outlines a series of steps for managing a linked list data structure, including adding and deleting nodes. It describes the process of allocating memory for new nodes and updating pointers to maintain the list's integrity. Additionally, it addresses potential overflow and underflow conditions during these operations.
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 ratings0% found this document useful (0 votes)
2 views9 pages
Singly linked list
The document outlines a series of steps for managing a linked list data structure, including adding and deleting nodes. It describes the process of allocating memory for new nodes and updating pointers to maintain the list's integrity. Additionally, it addresses potential overflow and underflow conditions during these operations.
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/ 9
sine ey, Yon
Bef cle a ea] or ah
etfs ac Ee
uf
£731 STO
nen ne oa
ee fehind: ones ee x
y = reion
Sh Big eet 3 eset Hae uf a hid
md!) dak andr as en
eof ra some type- a
Bein" alte Beginning of O Lined Sag) ——
- = Algorithen to nga “akine biginning . rt
\ Tespae TFAVAID’ = AULL . — a
a _._ awrite OvErRFLaw {-_~
“CEST ced
CENOF if) —
S102: SET NEW. NOW = AVAIL 5 2 52
Set NEw =noDE. —> DAtA'evAL
+> NEN = START} +
=WEw_NODE-
: SET START! then we ee spat bead wane
pe Unie va
te is. neta cen ee
AVELL ahead)
chit 2 Haske He “Store. the e'vawwe tobe ingerind.. CAL) iia the
1S DATA‘pan of the NEW vODes
(| 3 nanaae
LSP 3% Line NEw-soné ja the currnt (ist bY sti
pee NS Wel wexir! § poivirn ito. START Coddiess af Stax)
ee skp c: a eT fo_pvins to: the “filst ‘eee
Mee) the list. whith 5 & the newinode
Find inked List Z
| START 2 0M
| > OFF -TS aI Faas] oo el
The “roe with val 20" ig su hyn
fire beginning: of the _singl WN Geol Lisp.
SoAiMiog 0 HOND
wise Overflow»
Tt Garbo Step 10-0 +
Cenp oF if)
| Step2: SET wew-nope ~=AVAIL
Skp3: SET pale =Avpl —> NEXT
fond Vt prot ee
[> SP ht SET weujndpe —? DATA SMAL OT UE) |
| swp5: SET new. nope +> Next su 20
; | Siep6: SEC PIR =Srart ae
Bsr | roe tere sin 2 while “Pre —prvexr {=a a
vsh|sSap wel SET RIRS PIR -e> NEXT t i
CEND OF tow] ST 34 voy _T SU
| Sip 9 set rR NEXT = Ew -nope ara
Boe Ex NE 2
—— we [st
“af we wont ein. ode “node rea ni ae
od if ofier the lost node of the List _, that is fier
|_ node edits 3 |e
Step i ot me if_memony is_amilabe - Tena “OVERFLOW
| 15 printed .
—_| S#p2: Othewiise allocate _! space Ar _rewoade from
& avait __CAvailane spare
giep 3 ~ Updoie FAL tp point tothe nev fee Nock in lise
Sieph: get VAt= y into the NEW NOPE's Deto Poy,i Move. trout ts until 2 yeaey the » lgeies
uw TRAC ww
—— SEL PER] sae: Tse se
Step 8 Addithe agi) node aftr. the -nade- pointed by PTR. __
I This is done by stoting he odes Ah
the NEXT pan” of PIR O96 ia
IstaRr]
Gite -al Pae]
Now Ene New node is commecitd at the __end__of he
——ligt, the nade with -vayse, ‘his ra
AE < aor “the end of the = linked tt =
a (isewrite over.ow =
Stp2_se7_pvEw.Nope = Ave’
S SET AVAL = AVAILIT EON EXT oe Sic al
Go to step: 2 eT
ENDO. 5 woe 10 ST oid) ie) se
|Skp4: Sprivbwenope—> PATA = VAL 1
| spss “Ser Pre = Smet
Spe SbT EI) has
[Step ‘Reper Supe white : ix pos. t anil PTR) nord,
StpS:' ET PIR.SPTR—> NEXT
SCT its
Pant
3
END oF v0.08)
Step. 4 DR PIR = NULL
whit TAVALID POSITION
Reorn node to AvAR
Gore Skp12 CEnp oF nF]: VATS
Ste l0: setew wove > NexT =PTR—NExr”
4 Siepll : Sem PTR next = NEw_ Nope
Sip)?! €xIT
oh‘ r
te
we haverse the list ning _ 2 tos (3
z From node! (2 node 2 Cy)
22 Fincremented by | (i=2) Set ZI 4 [6 be
a y =NvIL_itmeans “pestiian. Maiti
mde —> Next fo Me “cumenr PTR Ner
NEW-NOD6 — NEXT pajt’s to Node? Caince cunenH
PIR IS ot node! and ode! —3NexT points “bytode 2
NEXT 4p Pont?” NEW Wonenone [O
write_UNDERFLow 5
Go 10 Sp 5 “ory egal
CEND OF IF) ‘ ;
WP 2'SET PIR= START Ho rae Ye beta
Sup 3: SEI_START = S7ART Segre ie
Sep: FREE pre jot
SHPS = EXIT *, QUA
“J eonsider othe lintod ‘yigti tt yet) 10 OMSL eae
at sist feb pasha ge
we wi ior ginning OF the (is.
Steed: ‘we cheer a ite tled “18 pisis'Ui ? nob rf fine ove £0
nooks in the ist condition of “(jmpeRruw™ | oréurs -
x2: TPinae me odes im _9 tet then wel Luge * ta pointer
Voriane PTR thar is set 10 point the Fist node _of
the list - START 2 if -nbjaneie *
Se ay Pe]
PIR
isi 3. Si 1s madtto pine ite the, ext pode iO sequence
“GEE
: joy the acle_Poinied by
Pr Gigs Creed -Stpa:
TE START =n
Write DNPERFLOW
Go to steps -
—
Sitp =
| Stepe :
ASHP t
\GEL-PTRAS PIR ~>NNExT
Cen OFF]
SET PIR START
| * _“Cewp'OF LOOP) _
SET PREPTR NEXT “=NULL
EREE PTR
Step 8t.ExIT,, 094
Sxl
z vas
wei undnt’ 10
i delete the last.SH 3: MOve PTR and PREPTR through the Listsuch that
NEXT foxtof PIR =wUiL. PREPTR ouways points the.
node just boro tne node pointed a “PTR.
START
ae oICEE Cpt ia
prepa = PIR
Parrot _pRePTR mode fowOLL
And fee the pre node (nae which is Poired by PTR) _
sTAet
Gh Tle ee
Fino list after _deletton of the last nade from fhe