JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
Interview Prep Master Doc
Neetcode 150
DSA Notes
Flowchart
More
Share
Explore
DSA Notes
Trees
Types of Binary Trees
Full Binary Tree:
each node has 0 or 2 children
Complete Binary Tree:
All levels of the tree are completely filled except the last level
The last level should be filled from left to right
Perfect Binary Tree:
All leaf nodes are the at the same level
Balanced Binary Tree:
Height of the tree is at a max of
log(n)
, where
n
is the number of nodes in the tree
Degenerate Binary Tree:
Height of the tree is
n
, so it’s effectively a linked list which defeats the purpose of a tree and the advantages it intends to provide
Tree Traversals
DFS
Inorder traversal
Left, Root, Right
Preorder traversal
Root, Left, Right
Postorder traversal
Left, Right, Root
BFS
Level-Order Traversal
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.