trees Flashcards

1
Q

trees store items _________

A

hierarchically

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

leaf or external node

A

node with no children

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

internal node

A

has one or more children

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

depth of a node

A

the length of the path from that node to the root

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

height of a node

A

the length of the longest path from that node to a leaf

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

ways of implementing a tree

A
  1. using an array
  2. pointer-based
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

downside of array tree implementation

A

inefficient when it comes to locating the children of a node

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

array and pointer-based approach both require ________________ amount of space

A

asymptotically the same

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

trie or prefix tree

A

simple and practically fast data structure that implements the dictionary adts

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

running time for dictionary operations in a trie

A

O(n)

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

binary trees

A

each node has at most two children

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

a binary tree is full

A

if all internal nodes have 2 children

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

nL(T) =

A

nI(T) + 1

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

maximum size of a BST of size n

A

n-1

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

minimum size of a BST of size n

A

log(n+1)-1

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

Catalan number is __ than n!

A

smaller

17
Q

expected height of a binary search tree

A

O(logn)

18
Q

AVL trees

A

height-balanced property: for every internal node the height difference between children is at most 1

19
Q

height of an AVL tree storing n keys

A

O(logn)

20
Q
A