Skip to content

Instantly share code, notes, and snippets.

@autotaker
Created December 22, 2015 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save autotaker/ebed443ea61424295eca to your computer and use it in GitHub Desktop.
Save autotaker/ebed443ea61424295eca to your computer and use it in GitHub Desktop.
let rec read_ints acc =
try
let v = read_int() in
read_ints (v::acc)
with
_ -> List.rev acc
let output_ints = List.iter (fun v ->
print_int v;
print_newline())
let main _ =
let ps = read_ints [] in
let start_t = Sys.time() in
let qs = List.sort compare ps in
let end_t = Sys.time() in
Printf.fprintf stderr "Sorting: %.5fs\n" (end_t -. start_t);
output_ints qs;;
main();;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment