datatype 'a tree= Leaf of 'a | Node of 'a tree * 'a * 'a tree
fun binSearch (Node(left,n,right)) x =
if x > n then false
else if x=n then true
else binSearch (Node(left,n,right)) x = binSearch (right) x andalso binSearch (left) x;
Ktoś pomoże? Co jest tutaj złego? ;/
Działa dla:
binSearch (Node (Node (Leaf 1, 2, Leaf 3), 4, Leaf 7)) 7;
nie działa dla:
binSearch (Node (Node (Leaf
Czy opyla się inwestować w jakiś droższy monitor do kodzenia, czy wystarczy może taki byle jaki? Nie chciałbym się po prostu męczyć przed monitorem. Załóżmy, że mam budżet max 600zł. Co polecicie?