Data Structures: Trees Flashcards

1
Q

What are tree stuctures?

A

A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties − The left sub-tree of a node has a key less than or equal to its parent node’s key. The right sub-tree of a node has a key greater than to its parent node’s key.

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

Tree structure operations

A

addChild
removeChild
traverse

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

Common uses for a tree structure

A

for storing hierarchical data with a directed flow.

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

Three kinds of traversals

A

preorder: the root node of the tree is processed first, then the left subtree is
traversed, then the right subtree.

postorder: the left subtree is traversed, then the right subtree, and then the root node is processed.

inorder: the left
subtree is traversed first, then the root node is processed, then the right subtree is traversed.

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