程序代写 SML Language

SML Language
1. [15 points Given the following type definitions.
datatype month
= Feb | Mar

Copyright By PowCoder代写 加微信 powcoder

Jul | Aug | Sep | Oct | Nov I
datatype ‘data tree
Node of ‘data tree
‘data tree;
Implement ML functions according to the given specifications.
a. [5 points] Function isLeapYear of type int
-> bool that returns true if the
given value is a leap year. A year is a leap year if it is divisible by 4 but not
by 100, or it is divisible by 400.
b. [5 points] Function
isValidDate of type (int
that returns true if the given date i.e. (day, month, year) tuple is valid. For
instance, (1, Jan, 2000) is valid while (31, Jun, 2021) is invalid. Note that
your function has to properly handle the dates in February for leap years.
c. (5 points) Function
traverseInOrder oftype int tree
-> int list that
returns the list of nodes when performing inorder traversal on the given tree.
Inorder traversal will traverse the left subtree, visit the root and traverse the
right subtree. For instance, the inorder traversal on the following tree will be
[6, 2, 4, 7, 8, 9.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com