changed bucketSort array handling to dynamic