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

Version Path
trackler-2.2.1.180 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.179 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.178 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.177 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.176 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.175 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.174 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.173 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.172 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.171 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.170 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.169 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.167 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.166 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.165 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.164 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.163 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.162 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.161 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.160 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs