Design an algorithm to merge k sorted arrays of numbers into a single sorted array. Your algorithm should run in O(n log(k)) time. Here n is the total number of elements in all arrays (the size of the output array). Hint: use a priority queue.