Good algorithm for combining items from N lists into one with balanced distribution?

前端 未结 7 1001
北荒
北荒 2020-12-05 20:54

Let\'s say I have the three following lists

A1
A2
A3

B1
B2

C1
C2
C3
C4
C5

I\'d like to combine them into a si

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 21:30

    You could simply combine the three lists into a single list and then UNSORT that list. An unsorted list should achieve your requirement of 'evenly-distributed' without too much effort.

    Here's an implementation of unsort: http://www.vanheusden.com/unsort/.

提交回复
热议问题