Upcoming SlideShare
×

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.
Standard text messaging rates apply

849

Published on

3 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
849
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
79
0
Likes
3
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. List ADT List is an ordered collection of items. Items in the collection may be integers, Strings, characters or any kind of objects. Basic operations are  Adding an item to the collection  Deleting an item from the collection  Testing if list is empty  Testing if list is full  Getting an item on specified location  Getting an item with specified key value
• 2. Linked List Collection of links with reference to the first. Each link has  part to store data  link that refers to the next link in the list. Data part of the link can be an integer, a character, a String or an object of any kind.
• 3. Linked Lists A linked list is a linear collection of data elements called nodes where linear order is given by means of pointers. Each node has two parts 1) Data Field – Stores data of the node 2) Link Field – Store address of the next node ( i.e. Link to the next node) LINK NODE : DATA
• 4. Linked Lists -START is List pointer contains address of the first node in the List - All nodes are connected to each other through Link fields - Link of the last node is NULL pointer denoted by ‘X’ sign - Null pointer indicated end of the liststart data link datalink datalink Data link  x A B C D
• 5. Algorithms Lets consider,• START is the 1st position in Linked List• NewNode is the new node to be created• DATA is the element to be inserted in new node• POS is the position where the new node to be inserted• TEMP and HOLD are temporary pointers to hold the node address
• 6. Algorithm to Insert a Node at the beginning 1. Input DATA to be inserted 2. Create NewNode 3. NewNode -> DATA = DATA 4. If START is equal to NULL a) NewNode -> LINK = NULL 5. Else a) NewNode -> LINK = START 6. START = NewNode 7. Exit