comp.lang.ada
 help / color / mirror / Atom feed
From: Peter Brooks <peter.h.m.brooks@gmail.com>
Subject: Re: Multiple keys for a map
Date: Wed, 18 Sep 2013 02:34:06 -0700 (PDT)
Date: 2013-09-18T02:34:06-07:00	[thread overview]
Message-ID: <d40be3c9-1096-4282-8c7b-4171e8380be6@googlegroups.com> (raw)
In-Reply-To: <10z06jaj3ok8l$.tmrmqhwjgloi.dlg@40tude.net>

On Wednesday, 18 September 2013 09:22:33 UTC+2, Dmitry A. Kazakov  wrote:
> On Tue, 17 Sep 2013 10:49:15 -0700 (PDT), Peter Brooks wrote:
> 
> 
> 
> > On Tuesday, 17 September 2013 18:52:37 UTC+2, Dmitry A. Kazakov  wrote:
> 
> >>  
> 
> >> Maps can be used to index such a table, or red-black trees, or whatever.
> 
> >> 
> 
> >> You could also take an existing light-weight RDBMS, e.g. SQLite3 or
> 
> >> Berkeley DB. There exist many Ada bindings to SQLite3.
> 
> >> 
> 
> > Thank you, yes, I'm hoping to avoid that overhead
> 
> If you want a better than O(n) search you need a map (or an equivalent of)
> for each search criterion. With wildcarded triplets it gives 7
> maps/indices:
> 
>    x,y,z -> Element
>    *,y,z -> Bucket of (x,y,z) keys or other references to elements in above
>    x,*,* 
>    x,y,*
>    x,*,*
>    *,y,*
>    *,*,z
> 
> It is quite straightforward to implement.
> 
That makes good sense - with a graph as well, it'd go up to 14, which is still quite reasonable in terms of overhead. I'll look into it. I see that it's quite easy to make it all memory resident, so there doesn't need to be any disc overhead.



  reply	other threads:[~2013-09-18  9:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 14:51 Multiple keys for a map Peter Brooks
2013-09-17 16:52 ` Dmitry A. Kazakov
2013-09-17 17:49   ` Peter Brooks
2013-09-18  7:22     ` Dmitry A. Kazakov
2013-09-18  9:34       ` Peter Brooks [this message]
2013-09-17 18:57 ` gautier_niouzes
2013-09-17 19:20   ` Peter Brooks
2013-09-18  5:19 ` Shark8
2013-09-18  5:44   ` Peter Brooks
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox