diff --git a/julia/.env b/julia/.env new file mode 100644 index 0000000..1a2ffd8 --- /dev/null +++ b/julia/.env @@ -0,0 +1,2 @@ +DOCKER_IMAGE=julia:1.10.4 +RUN_CMD='julia quicksort.jl' diff --git a/julia/quicksort.jl b/julia/quicksort.jl new file mode 100644 index 0000000..22b1368 --- /dev/null +++ b/julia/quicksort.jl @@ -0,0 +1,12 @@ +function quicksort(arr) + if length(arr) == 0 + return [] + end + pivot = pop!(arr) + return vcat(quicksort(arr[arr .< pivot]), pivot, quicksort(arr[arr .>= pivot])) +end + +readline() +arr = collect(parse.(Int, eachsplit(readline(), " "))) +sorted = quicksort(arr) +println(join(sorted, " "))