Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-07-13 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (249 votes), past polls