# PK2 -- SML Assignment 5

## Goal of Assigment

To start the implementation of an
abstract datatype for Red Black-tree. The type of it should be `'a
rbTree`. Every node should contain a tuple of type `int *
'a,` whose first element in the tuple is a key, which is an
integer, and the second element in the tuple is a satellite data
corresponding the key.

Implement the function `insert: (int * 'a)
-> 'a rbTree -> 'a rbTree,` which takes an element of type
`int * 'a` as the first argument, an Red Black-tree with *n*
elements as the second argument, and returns, a new Red Black-tree that is the given tree into which the
input element was inserted. The time complexity of this function should be
O(lg *n*)

Implement the function `inOrder: 'a
rbTree -> (int * 'a) list,` which takes a Red Black-tree as argument
and returns the in-order walk, represented as a list, of the Red Black-tree.

# Hand-in

Your report complying with
ethics rules
of the course should be handed in latest on **Friday the 11th of May before 17:00** via the online
course manager system, and should contain:
- SML abstract datatype
`'a rbTree` and SML functions
`insert` and `inOrder`, in an sml file, running under
Moscow ML version 2.01, and commented, complying with
coding convention.