Random Stuff with trees Flashcards

1
Q

Removing a node from a tree

A

Smallest node from the right sub tree, or largest from the left sub tree

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

Single rotation AVL

A

Zig zig,

Move up middle node to be parent of the other two nodes

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

Double rotation

A

Zig zag

First make it a zig zig, then do a single rotation maneuver

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

if given pre and post fix expression how do you construct a tree

A

find head node with pre
checkc post
if its right next to the node on the left side it is a child
fill in left to right

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

pre and in order expressions, how to construuct tree

A

mark first element of preorder as root
mark root in inorder
tree is divided left and right subtrees in inorder
repeat steps

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

full

A

every node other than the leaves has two children

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

complete

A

every row is complete except for the last (balanced)

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

perfect

A

every node has two leaves, left and right subtrees have the same height

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

height of a tree related to nodes

A

2^(h+1) -1

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