[algogeeks] Doubly linked list with one pointer

2011-10-02 Thread ~*~VICKY~*~
Design a logic to implement doubly linked list with only one pointer
-- 
Cheers,

  Vicky

-- 
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.



Re: [algogeeks] Doubly linked list with one pointer

2011-10-02 Thread rahul sharma
xor linked list.

On Sun, Oct 2, 2011 at 11:32 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:


 Design a logic to implement doubly linked list with only one pointer
 --
 Cheers,

   Vicky

  --
 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.



Re: [algogeeks] Doubly linked list with one pointer

2011-10-02 Thread ~*~VICKY~*~
@rahul : can u give any related links plz

On Sun, Oct 2, 2011 at 11:33 PM, rahul sharma rahul23111...@gmail.comwrote:

 xor linked list.

 On Sun, Oct 2, 2011 at 11:32 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:


 Design a logic to implement doubly linked list with only one pointer
 --
 Cheers,

   Vicky

  --
 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.




-- 
Cheers,

  Vicky

-- 
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.



Re: [algogeeks] Doubly linked list with one pointer

2011-10-02 Thread rahul sharma
http://www.geeksforgeeks.org/archives/12367

On Sun, Oct 2, 2011 at 11:34 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:

 @rahul : can u give any related links plz


 On Sun, Oct 2, 2011 at 11:33 PM, rahul sharma rahul23111...@gmail.comwrote:

 xor linked list.

 On Sun, Oct 2, 2011 at 11:32 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:


 Design a logic to implement doubly linked list with only one pointer
 --
 Cheers,

   Vicky

  --
 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.




 --
 Cheers,

   Vicky

  --
 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.



Re: [algogeeks] Doubly linked list with one pointer

2011-10-02 Thread rahul sharma
hope u were asking about dat...

On Sun, Oct 2, 2011 at 11:36 PM, rahul sharma rahul23111...@gmail.comwrote:

 http://www.geeksforgeeks.org/archives/12367


 On Sun, Oct 2, 2011 at 11:34 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:

 @rahul : can u give any related links plz


 On Sun, Oct 2, 2011 at 11:33 PM, rahul sharma rahul23111...@gmail.comwrote:

 xor linked list.

 On Sun, Oct 2, 2011 at 11:32 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:


 Design a logic to implement doubly linked list with only one pointer
 --
 Cheers,

   Vicky

  --
 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.




 --
 Cheers,

   Vicky

  --
 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.



Re: [algogeeks] Doubly linked list with one pointer

2011-10-02 Thread ~*~VICKY~*~
ya thanks a lot rahul !

On Sun, Oct 2, 2011 at 11:39 PM, rahul sharma rahul23111...@gmail.comwrote:

 hope u were asking about dat...


 On Sun, Oct 2, 2011 at 11:36 PM, rahul sharma rahul23111...@gmail.comwrote:

 http://www.geeksforgeeks.org/archives/12367


 On Sun, Oct 2, 2011 at 11:34 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:

 @rahul : can u give any related links plz


 On Sun, Oct 2, 2011 at 11:33 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 xor linked list.

 On Sun, Oct 2, 2011 at 11:32 PM, ~*~VICKY~*~ 
 venkat.jun...@gmail.comwrote:


 Design a logic to implement doubly linked list with only one pointer
 --
 Cheers,

   Vicky

  --
 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.




 --
 Cheers,

   Vicky

  --
 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.




-- 
Cheers,

  Vicky

-- 
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.



Re: [algogeeks] Doubly linked list with one pointer

2011-10-02 Thread sukran dhawan
xor linked list
http://www.geeksforgeeks.org/archives/12367

On Sun, Oct 2, 2011 at 11:33 PM, rahul sharma rahul23111...@gmail.comwrote:

 xor linked list.


 On Sun, Oct 2, 2011 at 11:32 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:


 Design a logic to implement doubly linked list with only one pointer
 --
 Cheers,

   Vicky

  --
 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.


-- 
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.



[algogeeks] doubly linked list program error

2011-08-01 Thread Rajesh Kumar
programs gives segmentation fault when we creat linked list
plz help me

#includestdio.h
#includemalloc.h
#includestdlib.h
struct node
{
struct node *prev;
int info;
struct node *next;
}*start;

main()
{
int choice,n,m,po,i;
start=NULL;
while(1)
{
printf(1.Create List\n);
printf(2.Add at begining\n);
printf(3.Add after\n);
printf(4.Delete\n);
printf(5.Display\n);
printf(6.Count\n);
printf(7.Reverse\n);
printf(8.exit\n);
printf(Enter your choice : );
scanf(%d,choice);
switch(choice)
{
 case 1:
printf(How many nodes you want : );
scanf(%d,n);
for(i=0;in;i++)
{
printf(Enter the element : );
scanf(%d,m);
create_list(m);
}
break;
 case 2:
printf(Enter the element : );
scanf(%d,m);
addatbeg(m);
break;
 case 3:
printf(Enter the element : );
scanf(%d,m);
printf(Enter the position after which this element is inserted
: );
scanf(%d,po);
addafter(m,po);
break;
 case 4:
printf(Enter the element for deletion : );
scanf(%d,m);
del(m);
break;
 case 5:
display();
break;
 case 6:
count();
break;
 case 7:
rev();
break;
 case 8:
exit(1);
 default:
printf(Wrong choice\n);
}/*End of switch*/
   }/*End of while*/
}/*End of main()*/

create_list(int num)
{
struct node *q,*tmp;
tmp= malloc(sizeof(struct node));
tmp-info=num;
tmp-next=NULL;
if(start==NULL)
{
tmp-prev=NULL;
start-prev=tmp;
start=tmp;
}
else
{
q=start;
while(q-next!=NULL)
q=q-next;
q-next=tmp;
tmp-prev=q;
}
}/*End of create_list()*/

addatbeg(int num)
{
struct node *tmp;
tmp=malloc(sizeof(struct node));
tmp-prev=NULL;
tmp-info=num;
tmp-next=start;
start-prev=tmp;
start=tmp;
}/*End of addatbeg()*/

addafter(int num,int c)
{
struct node *tmp,*q;
int i;
q=start;
for(i=0;ic-1;i++)
{
q=q-next;
if(q==NULL)
{
printf(There are less than %d elements\n,c);
return;
}
}
tmp=malloc(sizeof(struct node));
tmp-info=num;
q-next-prev=tmp;
tmp-next=q-next;
tmp-prev=q;
q-next=tmp;
}/*End of addafter() */

del(int num)
{
struct node *tmp,*q;
tmp=malloc(sizeof(struct node));
if(start-info==num)
{
tmp=start;
start=start-next;  /*first element deleted*/
start-prev = NULL;
free(tmp);
return;
}
q=start;
while(q-next-next!=NULL)
{
if(q-next-info==num) /*Element deleted in between*/
{
tmp=q-next;
q-next=tmp-next;
tmp-next-prev=q;
free(tmp);
return;
}
q=q-next;
}
if(q-next-info==num)/*last element deleted*/
{   tmp=q-next;
free(tmp);
q-next=NULL;
return;
}
printf(Element %d not found\n,num);
}/*End of del()*/

display()
{
struct node *q;
if(start==NULL)
{
printf(List is empty\n);
return;
}
q=start;
printf(List is :\n);
while(q!=NULL)
{
printf(%d , q-info);
q=q-next;
}
printf(\n);
}/*End of display() */

count()
{   struct node *q=start;
int cnt=0;
while(q!=NULL)
{
q=q-next;
cnt++;
}
printf(Number of elements are %d\n,cnt);
}/*End of count()*/

rev()
{
struct node *p1,*p2;
p1=start;
p2=p1-next;
p1-next=NULL;
p1-prev=p2;
while(p2!=NULL)
{
p2-prev=p2-next;
p2-next=p1;
p1=p2;
p2=p2-prev; /*next of p2 changed to prev */
}
start=p1;
}/*End of rev()*/


-- 
Regards
Rajesh Kumar

-- 
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.



Re: [algogeeks] doubly linked list

2010-06-17 Thread Vivek Sundararajan
@Anand: Thank you :)

On 17 June 2010 16:14, Vivek Sundararajan s.vivek.ra...@gmail.com wrote:

 Hi Anand, your dedicated and neatly formated reply is much appreciated! :)


 On 16 June 2010 23:59, divya jain sweetdivya@gmail.com wrote:

 yes u need to start frm beg..



 On 16 June 2010 17:15, Vivek Sundararajan s.vivek.ra...@gmail.comwrote:

 so, this means that i can traverse the list only from the beginning of
 the link list right?

 what if im given a pointer pointing to some node other than the head of
 the doubly linked list? will i be able to traverse in any direction now?

 please let me know if im missing something :)

 Thank you,
 Vivek


 On 16 June 2010 15:37, divya jain sweetdivya@gmail.com wrote:

 u can xor linked list. such that every node link contains the xor of its
 prev nd next node address.. since for 1st node prev is null ( 0) so its 
 link
 contains only next. now to calculate next of 2nd node xor its link with 1st
 node's link nd u ll get 3 rd node.s adddress nd so on..

 u can also use sum. store in link the sum of prev node n next node
 address.. bt this cn result in overflow. so xor method is better


 On 16 June 2010 09:14, sharad kumar sharad20073...@gmail.com wrote:

 u have to use XOR linked list

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Reduce, Reuse and Recycle
 Regards,
 Vivek.S




-- 
Reduce, Reuse and Recycle
Regards,
Vivek.S

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.



Re: [algogeeks] doubly linked list

2010-06-17 Thread Vivek Sundararajan
Hi Anand, your dedicated and neatly formated reply is much appreciated! :)


On 16 June 2010 23:59, divya jain sweetdivya@gmail.com wrote:

 yes u need to start frm beg..



 On 16 June 2010 17:15, Vivek Sundararajan s.vivek.ra...@gmail.com wrote:

 so, this means that i can traverse the list only from the beginning of the
 link list right?

 what if im given a pointer pointing to some node other than the head of
 the doubly linked list? will i be able to traverse in any direction now?

 please let me know if im missing something :)

 Thank you,
 Vivek


 On 16 June 2010 15:37, divya jain sweetdivya@gmail.com wrote:

 u can xor linked list. such that every node link contains the xor of its
 prev nd next node address.. since for 1st node prev is null ( 0) so its link
 contains only next. now to calculate next of 2nd node xor its link with 1st
 node's link nd u ll get 3 rd node.s adddress nd so on..

 u can also use sum. store in link the sum of prev node n next node
 address.. bt this cn result in overflow. so xor method is better


 On 16 June 2010 09:14, sharad kumar sharad20073...@gmail.com wrote:

 u have to use XOR linked list

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Reduce, Reuse and Recycle
Regards,
Vivek.S

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.



Re: [algogeeks] doubly linked list

2010-06-16 Thread divya jain
u can xor linked list. such that every node link contains the xor of its
prev nd next node address.. since for 1st node prev is null ( 0) so its link
contains only next. now to calculate next of 2nd node xor its link with 1st
node's link nd u ll get 3 rd node.s adddress nd so on..

u can also use sum. store in link the sum of prev node n next node address..
bt this cn result in overflow. so xor method is better

On 16 June 2010 09:14, sharad kumar sharad20073...@gmail.com wrote:

 u have to use XOR linked list

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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.



Re: [algogeeks] doubly linked list

2010-06-16 Thread Vivek Sundararajan
so, this means that i can traverse the list only from the beginning of the
link list right?

what if im given a pointer pointing to some node other than the head of the
doubly linked list? will i be able to traverse in any direction now?

please let me know if im missing something :)

Thank you,
Vivek

On 16 June 2010 15:37, divya jain sweetdivya@gmail.com wrote:

 u can xor linked list. such that every node link contains the xor of its
 prev nd next node address.. since for 1st node prev is null ( 0) so its link
 contains only next. now to calculate next of 2nd node xor its link with 1st
 node's link nd u ll get 3 rd node.s adddress nd so on..

 u can also use sum. store in link the sum of prev node n next node
 address.. bt this cn result in overflow. so xor method is better


 On 16 June 2010 09:14, sharad kumar sharad20073...@gmail.com wrote:

 u have to use XOR linked list

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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.



Re: [algogeeks] doubly linked list

2010-06-16 Thread Anand
yes you are right from the middle of list you will not be able to traverse
the list unless you know the previous/next address
Here are the limitiation of XOR linked list:

This form of linked list may be inadvisable:

   - General-purpose debugging tools cannot follow the XOR chain, making
   debugging more difficult;
[1]http://en.wikipedia.org/wiki/XOR_linked_list#cite_note-0
   - The price for the decrease in memory usage is an increase in code
   complexity, making maintenance more expensive;
   - Most garbage
collectionhttp://en.wikipedia.org/wiki/Garbage_collection_(computer_science)schemes
do not work with data structures that do not contain literal
   pointers http://en.wikipedia.org/wiki/Pointer_(computing);
   - XOR of pointers is not defined in some contexts (e.g., the
Chttp://en.wikipedia.org/wiki/C_(programming_language)language),
although many languages provide some kind of type
   conversion http://en.wikipedia.org/wiki/Type_conversion between
   pointers and integers;
   - The pointers will be unreadable if one isn't traversing the list — for
   example, if the pointer to a list item was contained in another data
   structure;
   - *While traversing the list you need to remember the address of the
   previously accessed node in order to calculate the next node's address.*

Thanks,
Anand

On Wed, Jun 16, 2010 at 4:45 AM, Vivek Sundararajan s.vivek.ra...@gmail.com
 wrote:

 so, this means that i can traverse the list only from the beginning of the
 link list right?

 what if im given a pointer pointing to some node other than the head of the
 doubly linked list? will i be able to traverse in any direction now?

 please let me know if im missing something :)

 Thank you,
 Vivek


 On 16 June 2010 15:37, divya jain sweetdivya@gmail.com wrote:

 u can xor linked list. such that every node link contains the xor of its
 prev nd next node address.. since for 1st node prev is null ( 0) so its link
 contains only next. now to calculate next of 2nd node xor its link with 1st
 node's link nd u ll get 3 rd node.s adddress nd so on..

 u can also use sum. store in link the sum of prev node n next node
 address.. bt this cn result in overflow. so xor method is better


 On 16 June 2010 09:14, sharad kumar sharad20073...@gmail.com wrote:

 u have to use XOR linked list

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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.



Re: [algogeeks] doubly linked list

2010-06-16 Thread divya jain
yes u need to start frm beg..


On 16 June 2010 17:15, Vivek Sundararajan s.vivek.ra...@gmail.com wrote:

 so, this means that i can traverse the list only from the beginning of the
 link list right?

 what if im given a pointer pointing to some node other than the head of the
 doubly linked list? will i be able to traverse in any direction now?

 please let me know if im missing something :)

 Thank you,
 Vivek


 On 16 June 2010 15:37, divya jain sweetdivya@gmail.com wrote:

 u can xor linked list. such that every node link contains the xor of its
 prev nd next node address.. since for 1st node prev is null ( 0) so its link
 contains only next. now to calculate next of 2nd node xor its link with 1st
 node's link nd u ll get 3 rd node.s adddress nd so on..

 u can also use sum. store in link the sum of prev node n next node
 address.. bt this cn result in overflow. so xor method is better


 On 16 June 2010 09:14, sharad kumar sharad20073...@gmail.com wrote:

 u have to use XOR linked list

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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.



[algogeeks] doubly linked list

2010-06-15 Thread Ratnesh Thakur
how to implement doubly linked list using only one pointer ?

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.



Re: [algogeeks] doubly linked list

2010-06-15 Thread sharad kumar
u have to use XOR linked list

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.