You are on page 1of 7

DSA using Python

Singly Linked List

Saurabh Shukla (MySirG)


- Agendas
① What is a list ?
② What is a node ?
③ Defining a node

④ Singly Linked List

⑤ Elementary operations
whatisalis-22.li
St is a linear collection of data items
also known as List Item

int
Example 1 : list of marks
30,32 , 20,35 , 41,38

str
Example 2 : list of city names
" "
Delhi
" " "
Jaipur
"
Indore
"
"
"
Bhopal
"
Itarsi ,
,
,

" "
Mumbai
" " "

Jabalpur
"
Gwalior
" "
Pune , .

Employee
3 : list of Employees
Example 104
103
102 "

Jen it
100 101 " " "
" Shivam
Akshay
"
" " "
Atul "
Savita
25000 40000 30000 Soooo
35 ooo
whatisanc.de?-
int
Example 1 : list of marks
30,32 , 20
,
35
, 41,38

⑤→i¥→☒*
item next item next

↑ ↑
SLL
Node type
Dnganode_
Class Node :
init ¢ self item = None next -_ None) :
def - -
_
_ , ,

self .
item = item

self .
next = next
S-inglylinkedlist.SU
is a linear data structure .

It and shrink
can
grow

SLL _
object

☐+→i→→i→i:
Operations on
Singly Linked List

insertion SLLC )
obj -_

)
deletion obj .
insert _
at _
start $ "

insert at last
is empty obj
_
_
.

Start Go)
_

at
Obj insert
_
_
.

traverse delete first


obj .
_

for x in Obi :

*nntcsc)

You might also like