课程: Java Algorithms
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
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's always a specific starting node in a tree data structure. Instead of the head, we call it the root node. The root node can contain data, in this case 3. It can also contain links to other nodes. The linked nodes are called child nodes. Since a node in a tree can have many different nodes, that's where the data becomes nonlinear. 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 itself…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。