top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Detect the corruption in a LinkList?

+3 votes
107 views

How to find if a node/pointer corrupted in a linked list any suggestion?

posted Dec 11, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

2 Answers

+1 vote

Here there few queries :

  1. Is it a single linked list or Double Linked List ?
  2. can we make this list circular ?

If the List is circular, we can get the corrupted node by iterating through the circular list and same with doubly linked list.

If the linked list is Single and not circular then,
the following can be implemented in the linked list to detect the corrupted link:
1. Use skip list.
2. use address of next to next node in Node.
3. convert the List to circular to detect the corrupted linked (if possible).

Thanks

answer Dec 11, 2013 by Amit Kumar
0 votes

Introduce a dummy number (construct it with some magic value) in the node structure. Check the value of this dummy number before accessing it.

Checking the pointer is not pointing to something fissy will be difficult and program can endup in segmentation fault.

answer Dec 11, 2013 by Naveena Garg
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...