Introducing 

Prezi AI.

Your new presentation assistant.

Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.

Loading…
Transcript

2017/ICTS/08

Topic 1

Linked Lists

What is the Linked list

  • a linked list is a data structure consisting of a group of nodes which together represent a sequence.
  • Linked Lists are similar to arrays except that they can reduce or extend their size without interrupting all of the elements. Which makes them far better than arrays.

Node

10 #1

Pointer

Data

Types of Linked Lists

Topic 2

• It is the basic type of inked list.

• Each node contains data and pointer to the next node.

• Lat node’s pointer is null.

• Limitations of singly linked list is we can traverse only in one direction

1. Singly

Linked List.

Head

Example

20 #104

40 null

10 #102

30 #106

#100

#102

#104

#106

2. Double

Linked List

• Each node of doubly linked list contains data and two pointers to the previous node and

the next node.

• Main advantage of the doubly linked list is we can traverse in any direction.

• Draw backs of double linked list is it requires more memory compared to singly linked

list.

Head

Example

null 10 #102

#100 20 #104

#102 20 null

#102

#104

#100

  • Circular linked list is a singly linked list where last node points to first node in the list.

  • It does not contain null pointers like singly linked list.

  • Can traverse only in one direction.

3.Circular

Linked list

Head

Example

40 #100

20 #104

10 #102

30 #106

#100

#102

#104

#106

Linked list operations

  • Insert

  • Delete

  • Traverse

Topic 3

Singly Linked List Insert Operation

  • enqueue ( 50 )

50 null

Topic 4

#4

rear

head

50 null

#4

Step 01

20 #3

10 #2

30 #4

#1

#2

#3

front

  • enqueue ( 40 )

40 null

#5

Topic 5

40 null

rear

head

#5

Step 01

20 #3

10 #2

30 #4

50 #5

#1

#2

#4

#3

front

Singly Linked List Delete Operation

  • dequeue ()

Topic 6

40 null

rear

head

#5

Step 01

20 #3

10 null

30 #4

50 #5

#1

#2

#4

#3

front

40 null

rear

head

#5

Step 02

20 #3

10 null

30 #4

50 #5

#1

#2

#4

#3

front

  • size ( )

items

head

Topic 7

20 #3

40 null

50 #5

30 #4

#4

#2

#3

#5

rear

front

  • return items
  • dequeue ()

Topic 8

head

step 01

20 null

30 #4

50 #5

40 null

#2

#3

#4

#5

front

rear

head

step 02

20 null

30 #4

50 #5

40 null

#2

#3

#4

#5

front

rear

Thank You

Topic 9

Learn more about creating dynamic, engaging presentations with Prezi