>
> I think you can solve the holes on delete by permuting the removed element
> with the last element and keeping a map from value to their index.
>
Good idea!
Thanks you very much for these suggestions.
>
You're welcome. The hashtrie is a much better idea for this situation, of
course.
Couldn
That's a super cool idea, but my data have no similar size. Anyway, that's
both simple and always better than what I do.(At worst it has an expected
complexity of O(n) if all the mass is in one value and the n-1 are
zero-ish).
I think you can solve the holes on delete by permuting the removed elem
That more or less what I had in mind, but I was wondering if someone has
already an Open Sourced
code for HashTries in Clojure.
But I can try your idea with binary tree first. It seems simpler.
Thanks again,
Nicolas
On Sun, Jun 27, 2010 at 5:13 AM, Jules wrote:
>
> You can use the same idea fo
cause these sets tend to be quite big in my project.
>
> > > I think that if I used a HashTrie with total-mass cached in each node,
> > > total-mass would be in constant time and draw in log time.
>
> > > So here is my question : does anyone has, for example for the
t Hash Map from elt to
>>>> mass:
>>>> - the total-mass is the reduce of (+ . second)
>>>> - drawing is choosing a random-number between 0 and the total-mass and
>>>> looping through the seq, to look for the corresponding element.
>>>>
>>>
of elements. This is a problem,
>>> because these sets tend to be quite big in my project.
>>>
>>> I think that if I used a HashTrie with total-mass cached in each node,
>>> total-mass would be in constant time and draw in log time.
>>>
>>
s anyone has, for example for the "clojure in
>> clojure" project, a sketch of an implementation of PersistentHashMap
>> in clojure itself? (I would be happy to contribute, if it needs more
>> work).
>> Or has anyone a better idea that mine to have drawable sets?
>&g
ion : does anyone has, for example for the "clojure in
> clojure" project, a sketch of an implementation of PersistentHashMap
> in clojure itself? (I would be happy to contribute, if it needs more work).
> Or has anyone a better idea that mine to have drawable sets?
>
> Th
t; > I think that if I used a HashTrie with total-mass cached in each node,
> > total-mass would be in constant time and draw in log time.
> >
> > So here is my question : does anyone has, for example for the "clojure in
> > clojure" project, a sketch of an imp
time.
>
> So here is my question : does anyone has, for example for the "clojure in
> clojure" project, a sketch of an implementation of PersistentHashMap
> in clojure itself? (I would be happy to contribute, if it needs more work).
> Or has anyone a better idea that mine
ojure" project, a sketch of an implementation of PersistentHashMap
in clojure itself? (I would be happy to contribute, if it needs more work).
Or has anyone a better idea that mine to have drawable sets?
Thanks for your help,
Best regards,
Nicolas.
--
You received this message because you are
11 matches
Mail list logo