i get more clear to my quest..
1.Doubly Linked List
2.Firstly some right pointer is missing....and lately..some left pointer is
missing
3.Head of pointer is given.
4.Repair the list..


On Wed, Aug 31, 2011 at 10:12 PM, Sanjay Rajpal <srn...@gmail.com> wrote:

> Chris : he said first, right pointer is missing, how can u repair that left
> pointer first as you can't go forward ?
>
>
> Sanju
> :)
>
>
>
> On Wed, Aug 31, 2011 at 9:39 AM, Chris <lokr...@gmail.com> wrote:
>
>> When you say missing, I assume the left or right pointer is null. If
>> that's the case, this could be a possible solution:
>>
>> // this fixes the missing left pointers traversing from the head
>> node* curr = head;
>> while (curr->right != null ) {
>>   if (curr->right->left == null) {
>>      curr->right->left = curr;
>>   }
>>   curr = curr->right;
>> }
>>
>> // reverse the logic to fix pointers in the other direction starting
>> at the end of the list
>> node* curr = tail;
>> while (curr->left != null) {
>>   if (curr->left->right == null) {
>>      curr->left->right = curr;
>>   }
>>   curr = curr->left;
>> }
>>
>> On Aug 31, 10:23 am, Dheeraj Sharma <dheerajsharma1...@gmail.com>
>> wrote:
>>  > A doubly linked list has one Left pointer missing and at some
>> point..one
>> > Right pointer missing..how to repair the doubly linked list?
>> > ?
>> >
>> > --
>> > *Dheeraj Sharma*
>> > Comp Engg.
>> > NIT Kurukshetra
>> > +91 8950264227
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to