Posts

Showing posts with the label Trees

2.10.1 Trees Video

PROFESSOR: Trees are about the most basic data structure that you're ever going to come across. They pervade computer science and other subjects. So let's talk about them. And the simplest definition of a tree is that a tree is a connected graph with no cycles. In this setting we're talking about simple graphs, and trees with undirected edges. Well, in order to make sense of that, we better have a definition of a cycle. There's a picture of a typical tree, but to be precise, what's a cycle in a simple graph? Well, it's a closed walk of length greater than 2 that doesn't cross itself. So the not crossing itself is the standard definition of a cycle that we were using in a directed graph. It simply means that it's a path, except that the beginning and end vertex are the same. So it looks like you start someplace at v, and then you go around to a and to w, and it's all distinct vertices as you go around in this path. Except that the path e...