Trees + Tree Traversal Flashcards

1
Q

What is a tree?

A
  • Symbol = T
  • Undirected graph
  • No Cycles but connected
  • Used to represent or break down a range of problems or concepts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you determine a tree structure?

A
  1. Each pair of verticies (u and v), one path from U to V
    1. That does not repeat any edges of vertices
  2. Additional edges between any vertices will produce a cycle
  3. Removing any edge produces a disconnected graph
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are rooted trees?

A
  • Common type of tree
  • One vertex (point) is specified as a root
  • Root usually at top of tree
  • Therefore a tree with n vertices will have n-1 edges
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Give the structure of a tree

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are binary trees?

A
  • Rooted Tree
  • In which every parent has at most two children
    • Child can be left or right
    • Every parent has at most one left and right child
  • FULL BINARY TREE each parent has two children
    • Total Vertices = 2n + 1 (n is internal vertices)
  • Full m-ary tree - each parent has m children
    • Total Vertices = mn + 1 (n is internal vertices)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the calculations for a FULL binary tree

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the calculations for a m-ary tree

A

Total Vertices = mn + 1 (n is internal vertices)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the importance of Binary Trees

A
  • Used to represent a mathematical or logical equation
  • Internal vertices are arithmetic operators
  • Leaves are variables
  • Can calculate using left to right
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is preorder traversal

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is inorder traversal?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Postorder Traversal

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly