Trees Flashcards

(8 cards)

1
Q

What is a Tree?

A

structure consisting of one node called the root and zero or one or more subtrees

edges flow from the root

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

Heap

A

complete binary tree which satisfies the heap ordering property

max-heap: every node is larger than its children
min-heap: every node is smaller than its children

insertion/deletion algorithm
deletion always happens at root

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

Balanced Binary Tree

A

for every node, the height of each subtree does not differ by more than one

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

Complete Binary Tree

A

every level of the tree is filled until the last level that is filled to the left with leaf nodes

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

Binary Search Tree

A

left subtree of a node contains only nodes with smaller values

right subtree of a node contains only nodes with larger values

the left and right subtree each must also be a binary search tree

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

Breadth First Traversal

A

algorithm for traversing or searching tree or graph data structures.

starts at the tree root (or some arbitrary node of a graph) and explores all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth level

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

Depth First Traversal

A

algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible along each branch before backtracking

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

Types of Depth First Traversals

A
Preorder Traversal (root, left, right)
Inorder Traversal (left, root, right)
Postorder Traversal (left, right, root)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly