Summary

Trees are a hierarchical data structure with notions of root, parent, children, and leaf nodes. Binary trees are trees where each parent node can have a maximum of two children nodes, each of which could be a binary tree itself.

Binary trees are recursively defined data structures like List.

We defined the various types of nodes of a binary tree. We also implemented a number of related functional algorithms.

We used Binary Search Trees for implementing dictionaries. We learned about some Scala idioms too.

All of this know-how arms us well to look at more fascinating functional data structures. On to it!

Get Learning Functional Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.