在julia中合并两个排序的数组

Lin*_*don 6 arrays sorting algorithm julia

在julia中是否有一个整洁的函数,它将合并两个已排序的数组并为我返回已排序的数组?我已经写了:

c=1
p=1
i=1
n=length(tc)+length(tp)
t=Array{Float64}(n)
while(c<=length(tc) && p<=length(tp))
    if(tp[p]<tc[c])
        t[i]=tp[p]
        p=p+1;
        i=i+1;
    else
        t[i]=tc[c]
        c=c+1;
        i=i+1;
    end
end
while(p<=length(tp))
    t[i]=tp[p]
    i=i+1
    p=p+1
end
while(c<=length(tc))
    t[i]=tc[c]
    i=i+1
    c=c+1
end
Run Code Online (Sandbox Code Playgroud)

但基地朱莉亚没有本地功能吗?

Sal*_*ali 2

不,这样的功能不存在。事实上,我还没有见过一种语言具有开箱即用的功能。

为此,您必须在每个数组中维护两个指针,比较值并移动较小的指针(根据我所看到的,这正是您所做的)。