3 Minute Intro: Introduction to Trees
ฝัง
- เผยแพร่เมื่อ 2 ส.ค. 2024
- Trees, they come in all different shapes and sizes. So that’s what we want to talk about today.
A tree is a type of graph, but there are no cycles.
In the tree data structure, we have a special node called the root. It is the top most parent. A leaf is a node with no children of its own.
The height of a tree is the longest path from the root to a leaf.
There are many types of trees used in computer science.
A binary tree is an important data structure in computer science. It is a tree where each node has at most two children.
A binary search tree is a order or “sorted” tree where for a given node, the left subtree contains values that are less than the node and the right subtree of a node contains values that are greater than the node.
A balanced tree is a tree where the differences in distance between the root and every leaf do not differ by a large amount.
A heap is a complete binary tree. It comes in two types. In a max heap, every node has a value grater than or equal than it’s descendants. In a min heap, every node has a less than or equal to it’s descendants.
Heaps are important data structures used in heap sort and priority queues.
Connect:
- Instagram: / canosielabs
- Twitter: / canosielabs
For additional videos and articles, check out Canosie Labs at: canosielabs.com
#softwaredeveloper, #codenewbie, #webdeveloper - วิทยาศาสตร์และเทคโนโลยี