View Single Post
  #5 (permalink)  
Old March 23rd, 2004, 05:21 PM
Ajay Swamy Ajay Swamy is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Linked list solution:

Traverse from the front of the list to end looking for the item with the index "n". When you find that item, save a reference to that "n"th indexed item, and set "n-1" indexed item to point to "n+1" indexed item.
   The primary data structure you use to implement this is irrelevant. Singly linked lists are poor performers by nature since their complexity is O(n) meaning to find the nth item you have to traverse through n nodes.

Make sense? else email: [email protected]

Reply With Quote