0% found this document useful (0 votes)
119 views17 pages

Data Structure & Algorithms: Sunbeam Infotech

This document discusses various operations on linked lists including: 1. Displaying a linked list by traversing from head to tail. 2. Adding a node to the last position of a linked list by traversing to the tail and updating next pointers. 3. Adding a node to the first position of a linked list by making the new node the head. The document provides pseudocode for common linked list operations like insertion, deletion and traversal.

Uploaded by

kamala thakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views17 pages

Data Structure & Algorithms: Sunbeam Infotech

This document discusses various operations on linked lists including: 1. Displaying a linked list by traversing from head to tail. 2. Adding a node to the last position of a linked list by traversing to the tail and updating next pointers. 3. Adding a node to the first position of a linked list by making the new node the head. The document provides pseudocode for common linked list operations like insertion, deletion and traversal.

Uploaded by

kamala thakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Data Structure & Algorithms

Sunbeam Infotech

Sunbeam Infotech www.sunbeaminfo.com


Linked List List
-

Singly
head
① display :
OCOD

② add Last : 0cm) to → 20 → 30 →


403
③ add First : OCD

⑨ add At Pos : 0 (pos)


avg.io
⑤ del First : OCD

⑥ del Last : OCD

⑦ del Athos : )
Ofpos
avg : Ocr)
⑧ detail :O

Sunbeam Infotech www.sunbeaminfo.com


Linked List List
-

Singly
head tail
① display :
OG3
%→za→3•
µ

② addlast : OCD →
403
www.mmn

③ add First : OCD


tail nm
head
⑨ add Athos : OCPOD a>
a
&
avg 0 I @ → z@ → → → 40
-9503
⑤ del First : OCD tail next am
. -_
;
del OG3V tail
⑥ Last :
-_ mm
;

Y%
del Athos OCPOSJ head tail
⑦ :


airs : %)
%→2a→3o→aoz
detail ←
f¥g
.

:O

Sunbeam Infotech www.sunbeaminfo.com
Linked List -

Singly Circular list .

head
100

+ rare heed ;
' ' 200 22 300 33 I @

'§←a3oa✓→
do {
pf( tour . data) ;

trav-toav.me xti

while ( trev !
- ↳
3
-

22 33
11

¥ if list is empty ,
return :

Sunbeam Infotech www.sunbeaminfo.com


Linked List -
add Last C)

head
frau
t t
To →$④ 4



so
.

to → see → →

am

F%
special : ③
① create non & init tisn
I 0

last node CH Io?.de


W→
till
② traverse
should be

had
③ msn.net
III
=

④ toav .

next = 'M
mn . next = head
;

Sunbeam Infotech www.sunbeaminfo.com


Linked List -

add First c)

① create nn & init


① nn head ②

f f
.③-
t
20 30 →
t
40
② train till last node

¥✓
to → →
go ③ nn near = had

④ last nude nest -7

③ head =
may

Sunbeam Infotech www.sunbeaminfo.com


Linked List → add At Pos .


damn

µ #Tf③
head

! a a → to

£N\pos÷|
1 → so → 30 *

i =3 pos = 8

§→aa→oyHoIµ
head

Sunbeam Infotech www.sunbeaminfo.com


del First C)
Linked List →

empty
⑨ if list is
head
ftp.w
,

exception
&§O
throw
¢
.

10 → → 30 → 40

n§jfW §d]÷n:±Eu
see

5l
① tour till last node .

87:*:[ 5%9

Sunbeam Infotech www.sunbeaminfo.com


Linked List → del At Pos C)

"

Id→
÷W
so
• →

Sunbeam Infotech www.sunbeaminfo.com


Linked List

feed 3②
1£ to



→ to → so

list into singly tin list



.

convert air

head next
-
=
null ;

② make had null


head ± null ;

Sunbeam Infotech www.sunbeaminfo.com


Linked List -

Doubly Linear List


head
head


L
65%7207303
10 2007 300-20030 Q

\gi
a 20

[ so . yg
of next node
next → adds
node
poor

adds of poor
.

Sunbeam Infotech www.sunbeaminfo.com


Linked List - display C)

head head

!
1 ✓ r
r ✓ ✓ it

T > 20730740 ]
{0520730--40} g.
tour head ; till last node
=
① traverse
null )
.

while Ctrav ! =
tour heads
=nW)
{ data
)j while Ctoav next !
pf ( tou
.

next ;
next tour
train din
.

tour tour
ten
in
.

z each node
② train & point
null )
Ctrov f-
forward display while
- 9 point ( ther data).

trait trav .
poev ;

ooorqdispby_
Sunbeam Infotech www.sunbeaminfo.com
Linked List -
add last c) ladd First C)
not
trov
head

IF2A Isa > 4%3--56


.

④ head

I> • ← 30=403

⇐Eii3
node is first node .

In
Sunbeam Infotech www.sunbeaminfo.com
Linked List
sin vd=5O nn
pos=4 d ③
head ⑤
50¥
I !=aaFga=f ]
[ ①tr*v

temp

add after last pos


special
.

case ; hnvd=sz tin

g-
t
pos =

mff.SI ]
head

& - zo
- go → Leo
Eve
]
- - ←

p 4
[ tear
temp

Sunbeam Infotech www.sunbeaminfo.com


Linked List -
del first C)

[IIEa > so I 403


¥4.gs Too

Sunbeam Infotech www.sunbeaminfo.com


Linked List - del last

head
trav

It The
[
→ we
-→µe-→4a ]
traverse till P0S

.

to tour 's neat ,


node's next
② previous
to tear 's poor
rude
③ next node 's poor
-

head tmv

← ! ②⇐¥÷ 9
pipe
~

Sunbeam Infotech www.sunbeaminfo.com


Thank you!
Nilesh Ghule <[email protected]>

Sunbeam Infotech www.sunbeaminfo.com

You might also like