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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://239221]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found