Week 5 Flashcards

1
Q

Tree

A

A set of interconnected nodes with no closed circuits or loops

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

Subtree

A

A tree rooted an internal node of the tree

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

Leaf(terminal node)

A

Any tree rooted an internal node of the tree

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

Root node

A

The first node of the tree

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

Branch

A

A link between two nodes within the tree

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

Degree of a node

A

Number of subtrees of that node

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

Level of a node

A

Number of branches on the path from the root to the node

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

Height / Depth of a tree

A

Number of nodes on the longest path from the root node to a leaf node

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

What is a Binary tree ?

A

Is a special case of a tree where every node is of degree two or less

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

A Binary Search Tree is a special case of a Binary tree where :

A

*The keys in the left subtree of the root precede the key in the root
*The key in the root node precedes the keys
*The left and right subtrees of the root are also Binary Search Trees

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

The first item is based on the normal binary search algorithm where:

A

*The first item to be tested will be stored in the root node
*If the required item is stored in this node then our search is complete
*If the required item comes before the data item stored in the root node then we will search the left subtree
*If the required item comes after the data item stored in the root node then we will search the right subtree
*The search will then process until either we locate the required data item or we reach a leaf node when we know that the required item is not stored in the BST

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

Cases to be considered before deleting a node from a BST

A

*The node is a leaf node
*The node has one subtree
*The node has two subtrees

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

Types of approaches to the traversal of a binary tree:

A

*Depth First Traversal (DFT)
*Breadth First Traversal (BFT)

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

Depth First Traversal (DFT)

A

The traversal proceeds along a path from the root through one child to the MOST distant descendant of that first child before processing the second child. To
implement this traversal a STACK is used.

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

Breadth First Traversal (BFT)

A

The traversal proceeds HORIZONTALLY from the root to all of its children then to its
children’s children and so on until all nodes have been processed. To implement this
traversal a QUEUE is used.

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

Things that needed to do before each node in Depth First Traversal (DFT) operates :

A

*Visit the node
*Traverse the Left subtree
*Traverse the Right subtree