Skip to content

Commit

Permalink
[gleam][binary-search-tree] rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
joaofnds committed Jun 28, 2024
1 parent d576403 commit 1839da8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gleam/binary-search-tree/src/binary_search_tree.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn to_tree(data: List(Int)) -> Tree {
}

pub fn sorted_data(data: List(Int)) -> List(Int) {
sorting_tree(to_tree(data))
to_list(to_tree(data))
}

fn insert(tree: Tree, num: Int) {
Expand All @@ -24,10 +24,10 @@ fn insert(tree: Tree, num: Int) {
}
}

fn sorting_tree(input: Tree) {
fn to_list(input: Tree) {
case input {
Nil -> []
Node(data, left, right) ->
list.concat([sorting_tree(left), [data], sorting_tree(right)])
list.concat([to_list(left), [data], to_list(right)])
}
}

0 comments on commit 1839da8

Please sign in to comment.