Amazon Interview Question
Software Engineer / DevelopersA tree is a data structure that has a single root node that can have child nodes. Each child node can have children nodes as well. Child nodes that share the same parent node are called siblings. A node that has no child nodes is called a leaf node.
There are two ways to traverse a tree. DFS (depth first search) and BFS (breadth first search) although special trees such as B+ trees use specialized algorithms to traverse through itself.
A tree is an acyclic graph with no direction.
- someone December 21, 2006