CEG's Linux User Group

  • Increase font size
  • Default font size
  • Decrease font size
Home Labs Split list

Split list

E-mail Print
User Rating: / 9
PoorBest 
Article Index
Split list
Source code
Documentation
Test case & Cpmpatibilty
All Pages

SPLIT LIST

Introduction :

A linked list is data structure that consists of a sequence of data records such that in each record there field is a that contains a link to the next record in the sequence. Consider the following list which has 4 nodes in it. The fourth node point to NULL marking the end of the list. The 'header' pointer points to the first node. The list is split at second position as shown below

Splitlist

The pointer 'l1' also points to the first node. A temporary pointer 'temp' is made to traverse through the list till the required position is reached.

Split list2

The pointer 'l2' is made to point to the node after temp. temp-> next is assigned NULL marking the end of first list. Thus, the given list is split into two.

 



Last Updated on Saturday, 06 June 2009 19:42  
Please register or login to add your comments to this article.