Sha256: fca928926c3bf3b3630a831127af2fd45447dcb5ab8b5f1c2d5f40ef701568de
Contents?: true
Size: 680 Bytes
Versions: 153
Compression:
Stored size: 680 Bytes
Contents
defmodule BinarySearchTree do @type bst_node :: %{data: any, left: bst_node | nil, right: bst_node | nil} @doc """ Create a new Binary Search Tree with root's value as the given 'data' """ @spec new(any) :: bst_node def new(data) do # Your implementation here end @doc """ Creates and inserts a node with its value as 'data' into the tree. """ @spec insert(bst_node, any) :: bst_node def insert(tree, data) do # Your implementation here end @doc """ Traverses the Binary Search Tree in order and returns a list of each node's data. """ @spec in_order(bst_node) :: [any] def in_order(tree) do # Your implementation here end end
Version data entries
153 entries across 153 versions & 1 rubygems