I solved the Binary Search Tree problem in Clojure.
I wrote three versions of the to-list function which makes a depth-first traversal of the tree returning the sequence of visited values.
This is my first version:
This is the second one using concat:
And the last one using the tree-seq function that I discovered looking at other solutions in Exercism:
You can nitpick my solutions here and/or see all the exercises I've done so far in this repository.
No comments:
Post a Comment