Re: Drawable Sets

2010-06-27 Thread Garth Sheldon-Coulson
> > 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

Re: Drawable Sets

2010-06-27 Thread Nicolas Oury
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

Re: Drawable Sets

2010-06-27 Thread Nicolas Oury
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

Re: Drawable Sets

2010-06-26 Thread Jules
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

Re: Drawable Sets

2010-06-26 Thread Garth Sheldon-Coulson
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. >>>> >>>

Re: Drawable Sets

2010-06-26 Thread Garth Sheldon-Coulson
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. >>> >>

Re: Drawable Sets

2010-06-26 Thread Nicolas Oury
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

Re: Drawable Sets

2010-06-26 Thread Garth Sheldon-Coulson
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

Re: Drawable Sets

2010-06-26 Thread Nicolas Oury
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

Re: Drawable Sets

2010-06-26 Thread Jules
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

Drawable Sets

2010-06-26 Thread Nicolas Oury
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