From the course: C# Algorithms
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
What is a tree? - C# Tutorial
From the course: C# Algorithms
What is a tree?
- [Instructor] If you're working with nonlinear data in an algorithm, the tree data structure can be a useful tool. A tree is a collection of nodes where each node might be linked to one, two, or even more nodes. Now, the last time we talked about nodes, we talked about them in the context of a linked list, where each node was connected in a linear order, node by node. The tree data structure presents a similar idea, but it applies to nonlinear data. Just like a linked list, there is always a specific starting node in the tree data structure. Instead of the head, we call it the root node. The root node contains data as well as links to other nodes. The linked nodes are called child nodes. Since a given node in the tree can have many different nodes, this is where the data becomes non-linear. Levels with multiple nodes start to form, and there are many different paths in the tree to take. We also refer to the root node as the parent of these child nodes. The root node itself has no…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.