Algorithms are one of the most important topics in Computer Science. An upcoming article involves an Object-Oriented Programming design pattern called the composite design pattern. The composite design pattern involves data structures called Trees. A data structure is an element in code that is used to store various types of data. Some of the most common types of data involve strings, ints, booleans(true or false values), floats, doubles, arrays, and more advanced data structures like structs and classes. Classes were briefly mentioned in the blog post here.
Classes can be thought of as type definitions. In other words, they are blueprints for data types similar to how a CAD drawing is a blueprint for mechanical or electronic devices. These classes can be used by other classes as data types. That is in a nutshell what object-oriented programming is about. Trees are one of the most fundamental data types in computer science.
What are trees?
A tree in nature has a root and branches. The root is the area of the ground from which the tree grows and receives nourishment from. In computer science, we can think of the root and branches as “nodes”. A tree in programming starts with a root node like the roots of a tree. Each node can contain a number of nodes that can contain other nodes. You can think of this as branches of a tree containing more branches. Below is a basic example of a tree coded in C#.
Trees are a fascinating part of computer science and are used in some of the world’s largest companies like Google and Amazon. Trees are used in many algorithms. To learn more about algorithms or trees, I suggest visiting the website GeekForGeeks which has many articles on trees and many other topics in computer science. To view our other blog posts visit this link here.