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.159 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.158 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.157 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.156 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.155 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.154 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.153 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.152 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.151 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.150 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.149 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.148 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.147 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.146 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.145 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.144 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.143 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.142 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.141 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs
trackler-2.2.1.140 tracks/elixir/exercises/binary-search-tree/binary_search_tree.exs