Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
# [1;2;1;3;2] < [1;2;0;4;4;0;0;0];;
|
||||
- : bool = false
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
# [|1;2;1;3;2|] < [|1;2;0;4;4;0;0;0|];;
|
||||
- : bool = true
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
let rec ordered_lists = function
|
||||
| x1::tl1, x2::tl2 ->
|
||||
(match compare x1 x2 with
|
||||
| 0 -> ordered_lists (tl1, tl2)
|
||||
| 1 -> false
|
||||
| _ -> true)
|
||||
| [], _ -> true
|
||||
| _ -> false
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
(* copy-paste the code of ordered_lists here *)
|
||||
|
||||
let make_num_list p n =
|
||||
let rec aux acc =
|
||||
if Random.int p = 0 then acc
|
||||
else aux (Random.int n :: acc)
|
||||
in
|
||||
aux []
|
||||
|
||||
let print_num_list lst =
|
||||
List.iter (Printf.printf " %d") lst;
|
||||
print_newline()
|
||||
|
||||
let () =
|
||||
Random.self_init();
|
||||
let lst1 = make_num_list 8 5 in
|
||||
let lst2 = make_num_list 8 5 in
|
||||
print_num_list lst1;
|
||||
print_num_list lst2;
|
||||
Printf.printf "ordered: %B\n" (ordered_lists (lst1, lst2))
|
||||
|
|
@ -0,0 +1 @@
|
|||
val ordered_lists : 'a list * 'a list -> bool
|
||||
Loading…
Add table
Add a link
Reference in a new issue