Trees intro Flashcards
What r the general types of trees?
1 - family trees 2 - Decision trees 3 - expression trees 4 - file system 5 - hirearchy 6 - to express syntax in code
why are trees important and there are so many of them?
1 - dynamic DS
2 - structure conveys information
what is the recursive definition of a tree?
empty or :
with a node:
which have a key and might have child nodes
what is the root?
the top node in a tree
what is a leaf?
a node with no children
what is an interior node?
a node with a child
what is a level?
1+ the number of edges between root and node
what is the height?
maximum depth of subtree node and farthest leaf
what is a forest?
a collection of trees?
what is BFS?
it’s breadth first search:
we check all the connections at on time
what is DFS?
it’s depth first search:
we check only one connection at a time
what is the DS for BFS?
queue
what is the DS for DFS?
stack