xor linked list

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2007
Posts: 62
Reputation: Ptolemy is an unknown quantity at this point 
Solved Threads: 8
Ptolemy's Avatar
Ptolemy Ptolemy is offline Offline
Junior Poster in Training

Re: xor linked list

 
0
  #11
Oct 25th, 2007
>but don't know how to use cast. can you help me?
That's something that any C++ book or reference will tell you how to use. It would be "cast" or "type cast" in the index.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 6
Reputation: phoenixlsk is an unknown quantity at this point 
Solved Threads: 0
phoenixlsk phoenixlsk is offline Offline
Newbie Poster

Re: xor linked list

 
0
  #12
Oct 25th, 2007
thank you
:-)
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,117
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: xor linked list

 
0
  #13
Oct 25th, 2007
Try reading some of the sticky posts that are labels Read Me: to learn good posting techniques...
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1
Reputation: manojthesingham is an unknown quantity at this point 
Solved Threads: 0
manojthesingham's Avatar
manojthesingham manojthesingham is offline Offline
Newbie Poster

Re: xor linked list insert in C++

 
0
  #14
Mar 13th, 2009
class xll
{
public:
int data;
unsigned long link;
};

class xlist
{
xll *head,*tail;
xlist(){head = NULL;tail = NULL}
void insert(int);
};
void xlist :: insert (int ele)
{
xll *node = (xll*) malloc (sizeof(xll));
node->data = ele;
xll *temp = head,*prev = NULL;
while(temp != NULL)
{
next = (xll *) (temp->link ^ (unsigned long) prev);
prev = temp;
temp = next;
}
if(prev == NULL)
head = node;
else
{
node->link ^= (unsigned long) prev ^ (unsigned long) temp;
prev->link ^= (unsigned long) temp ^ (unsigned long) node;
temp->link ^= (unsigned long) prev ^ (unsigned long) node;
}
}
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC