[{"name":"RedBlackTrees","comment":" Red Black Trees are self-balancing binary seach trees which add one bit of\nmemory to the standard BST (usually denoted by the colours red and black). With\nthis additional tracking information; the worst case search, insert and delete\ntime complexity drops to O(log N) [from O(N) in the BST case].\n\n\n# Types\n\n@docs RedBlackTree, Colour\n\n\n# Building\n\n@docs empty, fromList, insert\n\n\n# Utilities\n\n@docs isMember, size, blackHeight, height\n\n\n# Validation\n\n@docs isValid\n\n","unions":[{"name":"Colour","comment":" Since this is a red black tree representation, we ignore the green brown convention.\n","args":[],"cases":[["Red",[]],["Black",[]]]},{"name":"RedBlackTree","comment":" Trees can be comprised of either empty leaves or nodes containing a value,\na represesentative colour and two child branches.\n","args":["comparable"],"cases":[]}],"aliases":[],"values":[{"name":"blackHeight","comment":" Every path from the root to the leaves of a red black tree must contain\nthe same number of black nodes. The `blackHeight` is the value of this path length.\nNotably, this is also the shortest path from root to leaf.\n","type":"RedBlackTrees.RedBlackTree comparable -> Maybe.Maybe Basics.Int"},{"name":"empty","comment":" An empty tree for ease of use when constructing trees.\n","type":"RedBlackTrees.RedBlackTree comparable"},{"name":"fromList","comment":" Generate a Red Black representation of a list.\n","type":"List.List comparable -> RedBlackTrees.RedBlackTree comparable"},{"name":"height","comment":" Calculate the height of the tree. The longest path from the root to a leaf\nis at most twice the length of the shortest path.\n\n    height tree <= 2 * (Maybe.withDefault 0 <| blackHeight tree) == True\n\n","type":"RedBlackTrees.RedBlackTree comparable -> Basics.Int"},{"name":"insert","comment":" Adds a new value to the tree. Since this may cause on of the four\nred black constraints to be broken, there may be a need to recolour nodes\nor rebalance the tree.\n","type":"comparable -> RedBlackTrees.RedBlackTree comparable -> RedBlackTrees.RedBlackTree comparable"},{"name":"isMember","comment":" Check if a value currently exists within in a tree.\n","type":"comparable -> RedBlackTrees.RedBlackTree comparable -> Basics.Bool"},{"name":"isValid","comment":" Verifies that a given tree is a valid red black tree by checking\n\n1.  It satisfies the binary search order property\n2.  The root node is coloured `Black`\n3.  No red node has a child node that is also red\n4.  Every path from the root to a leaf contains the same number of black nodes\n\n","type":"RedBlackTrees.RedBlackTree comparable -> Basics.Bool"},{"name":"size","comment":" Count the number of elements in the tree.\n","type":"RedBlackTrees.RedBlackTree comparable -> Basics.Int"}],"binops":[]}]