Author |
Topic: Single and double linked list (Read 775 times) |
|
oriole
Newbie
Posts: 32
|
|
Single and double linked list
« on: Jun 28th, 2008, 11:59pm » |
Quote Modify
|
Can doubly linked list be simulated through singly linked list
|
|
IP Logged |
|
|
|
TenaliRaman
Uberpuzzler
I am no special. I am only passionately curious.
Gender:
Posts: 1001
|
|
Re: Single and double linked list
« Reply #1 on: Jun 29th, 2008, 2:22am » |
Quote Modify
|
Keep two singly linked list, one goes in forward and one goes in reverse direction. -- AI
|
|
IP Logged |
Self discovery comes when a man measures himself against an obstacle - Antoine de Saint Exupery
|
|
|
oriole
Newbie
Posts: 32
|
|
Re: Single and double linked list
« Reply #2 on: Jun 29th, 2008, 4:27am » |
Quote Modify
|
Oops that was too simple... was thinking of doing it through a single link list
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Single and double linked list
« Reply #3 on: Jun 29th, 2008, 7:19am » |
Quote Modify
|
Keep two pointers, change every next pointer into a XOR of the two consecutive next pointers. There should be a number of threads this has come up in; one of which is here. (Success at using the search function may vary, but just in case you hadn't seen/tried it, I would like to point out it does exist, it's at the top of the page.)
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
oriole
Newbie
Posts: 32
|
|
Re: Single and double linked list
« Reply #4 on: Jun 29th, 2008, 9:43am » |
Quote Modify
|
on Jun 29th, 2008, 7:19am, towr wrote:Keep two pointers, change every next pointer into a XOR of the two consecutive next pointers. There should be a number of threads this has come up in; one of which is here. (Success at using the search function may vary, but just in case you hadn't seen/tried it, I would like to point out it does exist, it's at the top of the page.) |
| Thanks towr.. I did tried to search but did not get any relevant links.. next time I'll try modifying my search string
|
|
IP Logged |
|
|
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Re: Single and double linked list
« Reply #5 on: Jun 30th, 2008, 7:57am » |
Quote Modify
|
on Jun 29th, 2008, 9:43am, oriole wrote:next time I'll try modifying my search string |
| It's also often helpful to extend the maximum search time. The default is 365 days: I usually make it 3650 just because it's an easy change... --SMQ
|
|
IP Logged |
--SMQ
|
|
|
|