Tree Data Structure in JavaScript
lessonDuration 3m 57s
A tree data structure is a graph without any cycles. I can hear you saying, "Kyle, that's a super helpful explanation," with a healthy dose of sarcasm already. "No cycles" means that no three nodes create a circuitous path. In a tree, nodes have a single parent node and may have many children nodes. They never have more than one parent nor point to any siblings. The most common tree structure you see is a web page. The underlying structure is often called the "DOM tree". The `html` element forms the root of our tree, with children of `head` and `body`, so on and so forth. In this lesson, we'll create a quick example of a DOM tree with our tree data structure.