structure v0.2.2 Structure.BST View Source

A Binary Search Tree. This is a binary tree where each element is greater than every element in its left subtree and less than every element in its right subtree.

Link to this section Summary

Functions

Walks a tree inorder

Insertes a new item into the Binary Search Tree

Creates a new Binary Search Tree

Removes an item from the tree

Link to this section Functions

Walks a tree inorder.

Insertes a new item into the Binary Search Tree.

Example:

iex> Structure.BST.insert(nil, 12)
%Structure.BST{val: 12, left: nil, right: nil}

Creates a new Binary Search Tree.

Example:

iex> Structure.BST.new()
%Structure.BST{val: nil, left: nil, right: nil}

Removes an item from the tree.