Generating all distributions of objects to bins

  • Authors:
  • Muhammad Abdullah Adnan;Md. Saidur Rahman

  • Affiliations:
  • Department of Computer Science and Engineering, Bangladesh University of Engineering and Technology (BUET), Dhaka, Bangladesh;Department of Computer Science and Engineering, Bangladesh University of Engineering and Technology (BUET), Dhaka, Bangladesh

  • Venue:
  • International Journal of Computer Mathematics
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

In this paper, we give an elegant algorithm to generate all distributions of n identical objects to m bins without repetition. The best known previous algorithm, due to Klingsberg, generates each distribution in constant time in average sense. Using a new technique of efficient tree traversal, in this paper we improve the time complexity to constant time (in ordinary sense). By modifying our algorithm, we can generate the distributions in anti-lexicographic order. Overall space complexity of our algorithm is O(mlgn), where m is the number of bins and n is the number of objects.