Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Bijective data association structure?

by jlongino (Parson)
on Feb 27, 2003 at 19:35 UTC ( #239221=note: print w/ replies, xml ) Need Help??


in reply to Bijective data association structure?

You'll probably just want to build your hash as a circular linked list:

my $position_of = ( 'A' => { next_key => 'A#', prev_key => 'G#', # other stuff . . . }, 'A#' => { next_key => 'B', prev_key => 'A', # other stuff . . . }, ### in-between stuff 'G#' => { next_key => 'A', prev_key => 'G', # other stuff . . . }, );
Update: with circular linked lists you usually keep track of head/tail:
my $head = 'A'; my $tail = 'G#';

--Jim


Comment on Re: Bijective data association structure?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://239221]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2015-07-31 15:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls