Binary Tree with Generics using Enum
Published in
3 min readSep 25, 2023
including an Addnode func in the Eidhof example from Advanced Swift.
Deep in reading Eidhof’s examples and dug into this Binary Search tree. I read through all of Sedgewick years ago but in general I live in the land of making Apps and don’t worry about the Computer Science stuff. But his book is so good I’ve been drawn into it lately.
The comments in the code are my own.
// so first, a binary tree defined as an enum
// first case is the leaf
// second case is a node that carries a value
// and two BinaryTree enums…