Type of the elements in the two queues to merge.
A queue to merge. No change after operation.
Another queue to merge. No change after operation.
A callable object that determines the element order in the merged queue; it has not effect on the relative order of elements in the original queues.
Generated using TypeDoc
Stable-merges two queues.
Elements are compared using the binary predicate
compareto determine the order in which they appear in the merged queue. Relative order of elements in the original queues is preserved. A new queue is created and returned if both queues to merge are not empty.Returns
The merged queue if both queues to merge are not empty, one of the queues to merge if the other is empty,
nullif both are empty.Throws
Error if the two queues to merge are of different queue types.
Note
The complexity of the merge algorithm is
O(n1 + n2)in both time and space, wheren1andn2are the sizes of the two queues to merge.