Your SlideShare is downloading. ×
Doubly linked list
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Doubly linked list

5,742
views

Published on

for contact …

for contact
twitter : @f13hd
email : alking@hotmail.de

Published in: Education, Technology, Business

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,742
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
275
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. DefinitionDoubly is a type of linked list thatallows us to go in both directions and in a linked list. Powerpoint Templates Page 3
  • 2. A node in a doubly linked liststores two references: - a next link, which points to the next node in the list, - a prev link, which points to the previous node in the list. Powerpoint Templates Page 4
  • 3. Such lists allow for :a great variety of quick updateoperations, including insertion andremoval at both ends, and in themiddle. Powerpoint Templates Page 5
  • 4. Header and Trailer Sentinels To simplify programming, it is convenient to add special nodes at both ends of a doubly linked list: • The header has a valid next reference but a null prev reference, • while the trailer has a valid prev reference but a null next reference. What is the Sentinels? A sentinel nodes do not store any elements.and second name for sentinels node is “ Dummy ” Powerpoint Templates Page 6
  • 5. Doubly Linked ListsFigure 3.14: A doubly linked list with sentinels, header and trailer, marking the ends of the list. An empty list would have these sentinels pointing to each other. We do not show the null prev pointer for the header nor do we show the null next pointer for the trailer. Powerpoint Templates Page 7
  • 6. Implementation
  • 7. DeletionFigure 3.15: Removing the node at the end of a a doubly linked list withheader and trailer sentinels: (a) before deleting at the tail; (b) deleting atthe tail; (c) after the deletion.
  • 8. DeletionCode Fragment 3.18: Removing the last node of a doubly linked list. Variable size keeps track of the current number of elements in the list. Note that this method works also if the list has size one.
  • 9. InsertionFigure 3.16: Adding an element at the front: (a)during; (b) after.
  • 10. InsertionCode Fragment 3.19: Inserting a new node v at the beginning of a doublylinked list. Variable size keeps track of the current number of elements inthe list. Note that this method works also on an empty list.
  • 11. Powerpoint Templates Page 13

×