let rec log2 n =
if n=1 then 0 else 1+log2 ((n+1)/2)
let rec min lst =
match lst with
| h::[] -> h
| h::t ->
let min1 = min t
if h<min1 then h else min1
[[1;2;3];[1;3;2];[2;1;3];[2;3;1];[3;1;2];[3;2;1]]
The permutations may be in a different order.
type BinaryTree =
| Void
| Node of int*BinaryTree*BinaryTree
A binary tree is either Void (empty tree) or Node(value,left,right), where value is the value stored in the node, left is the left subtree, and right is the right subtree.