vimwiki/tech/binary_tree.wiki
2021-10-10 23:22:53 -04:00

25 lines
639 B
Plaintext

= Binary tree =
A branching data structure that is pointer heaven. Traversal is very fun
== Good For ==
* Finding data in log(n) time
* Organizing tiered data
== Bad For ==
* Cache Hits
== Common operations ==
=== Level Order Traversal ===
To traverse a tree level by level it requires a queue to keep track of what is
next to traverse. To do this we first push the all child nodes onto the queue.
We then visit each element in the node and push on its children into the queue.
We do this for every element till we have no elements in the queue. When this
happens, we have traversed the entire tree level by level.
[[algorithms]]