Tree Data Structure in JavaScript

Kyle Shevlin
InstructorKyle Shevlin

Share this video with your friends

Send Tweet

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.

~ 2 years ago

Why does it have package.lock as lesson files? That's not very polite :( @Kyle Shevlin

Kyle Shevlin
Kyle Shevlininstructor
~ a year ago

I'm not sure what the concern is. The package-lock.json is a file automatically added by npm when you install packages. There is no issue with having it there. In fact, it's a positive that it exists. Each individual lesson has its own package.json file so you can run tests locally on the lesson as you're working on it.