first commit

This commit is contained in:
=
2024-02-07 15:06:50 +01:00
commit af02e453c1
55 changed files with 2166 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
function mergeSorted(A::Vector{T}, B::Vector{T}) where T
la = length(A)
lb = length(B)
C = Vector{T}(undef, la + lb)
a = b = 1
while (a <= la && b <= lb)
if A[a] < B[b]
C[a+b-1] = A[a]
a += 1
else
C[a+b-1] = B[b]
b += 1
end
end
if a > la
while b <= lb
C[a+b-1] = B[b]
b += 1
end
else
while a <= la
C[a+b-1] = A[a]
a += 1
end
end
return C
end