lib/berkeley_library/util/arrays.rb
# Merges two arrays in an order-preserving manner.
# @param a1 [Array] the first array
# @param a2 [Array] the second array
# @return [Array] a merged array that is an ordered superset of both `a1` and `a2`
# @see Arrays#ordered_superset?
Merges two arrays in an order-preserving manner.
Merges two arrays in an order - preserving manner .
def merge(a1, a2)
        return a1 if a2.empty?
        return a2 if a1.empty?
        shorter, longer = a1.size > a2.size ? [a2, a1] : [a1, a2]
        do_merge(shorter, longer)
      end
def merge ( a1 , a2 ) return a1 if a2 . empty? return a2 if a1 . empty? shorter , longer = a1 . size > a2 . size ? [ a2 , a1 ] : [ a1 , a2 ] do_merge ( shorter , longer ) end
Merges two arrays in an order-preserving manner.
Merges two arrays in an order - preserving manner .
a merged array that is an ordered superset of both `a1` and `a2`
a merged array that is an ordered superset of both ` a1 ` and ` a2 `
Array
a1
the first array
the first array
a2
the second array
the second array
see
None