Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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

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 about the Monastery: (2)
As of 2016-08-25 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (353 votes). Check out past polls.