[erlang-questions] Bucket Sort
Thu May 21 03:33:20 CEST 2009
On Thu, May 21, 2009 at 12:20 AM, tonakai <aykutsoysal@REDACTED> wrote:
> i am a erlang newbie and trying to implement bucket sort, but i am stuck at
> the beginning because I can't figure out a way to divide the list into small
> buckets, i try to use accumulators but number of buckets is not fixed, i
> think i need to find a way to populate lists of lists.
> also i am thinking for concurrent version of it, but its also same problem,
> i need to send the number to the correct bucket (process).
> any ideas?
Can you give an example of the type of data you are working with?
Typically the 'dict' module is useful for grouping things, e.g. :
fun(El, Acc) ->
Bucket = (3 * (El div 3)),
dict:append(Bucket, El, Acc)
More information about the erlang-questions