Tree Flashcards

1
Q

Complete Binary Tree :第 i 层最多有多少个节点?

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

Perfect Binary Tree : 高度为h的树会有多少个节点?

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

如何定义 二叉树的节点?

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

Basic Terminologies in Binary Tree :

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

Binary Tree : Properties

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

Binary Tree types : Full Binary Tree

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

Binary Tree types : Complete Binary Tree

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

Binary Tree types : Perfect Binary Tree

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

Binary Tree types : Degenerate Binary Tree

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

Binary Tree types : Balanced Binary Tree

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

Binary Search Tree : define Tree structure

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

Binary Search Tree : newNode

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

Binary Search Tree : Insert

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

Binary Search Tree :find_minimum

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

Binary Search Tree : find _maximum

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

Binary Search Tree : height

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

Tree : Time Complexity && Space Complexity

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

考试题:根据前序、中序遍历画出二叉树

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

考试题:根据后序、中序遍历画出二叉树

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

前序、中序、后序遍历:

21
Q

level_lraversal : how it works

Hint:
1.isempt
2.create queue & temp
3.enqueue(root)
4.while
{
temp = dequeue (queue)
…..
}
5.free

22
Q

level_Traversal : create 3 ADT

Hint: node,queue node, queue

23
Q

level_lraversal - create queue containing node : Isempty

24
Q

level_lraversal - create queue containing node : create queue

25
Q

level_lraversal - create queue containing node : enqueue

A
  1. temp
  2. Null: front = temp
  3. ! Null: rear & temp
26
Q

level_Traversal - create queue containing node : dequeue

A
  1. isempty
    2.temp (delete)
    3.data(return)
    4.front (move)
    5.free
    6.return
27
Q

后序遍历(Post order):层看法失效的情况,但是右侧法依然可以

A

原因:最后一层的上方有两个父母

28
Q

Tree : Preorder Traversal

29
Q

Tree : Inorder Traversal

30
Q

Tree : Postorder Traversal

31
Q

Binary Search Tree : Is_binarysearch_tree (With no biggest and smallest datas)

Hint
1.exit condition
2.false condition
3.recursion

32
Q

Binary Search Tree : Is_binarysearch_tree (With biggest and smallest datas)

Hint:
1.exit condition
2.false condition
3.recursion

33
Q

Binary Search Tree : Delete

Hints:
Part 1 : exit condition
Part 2 : Recursion part
1.search (also plays a role in deleting nodes with 2 children)
2.delete nodes with no child or one child
3.delete nodes with 2 children:
1️⃣find the smallest node in the right sub tree
2️⃣delete (substitute the deleted node)
3️⃣link the rest subtree

34
Q

Binary Search Tree : Find_inorder_successor

Hint:
Part 1: exit condition
Part 2: recursion
1️⃣right child exist
reach deepest
2️⃣ right child doesn’t exist
1.root > data
accessor ,root
2.root < data
root
3.root = data
return

35
Q

二叉树的性质总结 :

A

补充 “ 树的性质 : 节点数 = 分支数 + 1 ”

36
Q

例题 :树求叶子节点个数

A

hint : 完全二叉树度为0的节点数 = 度为2的节点数加1

37
Q

例题 :求树的高度

38
Q

例题 :满__叉树第n层的节点数

A

Hint :深度从1开始

39
Q

例题 :哈夫曼树的性质

40
Q

例题 :树的性质 – 节点数 = 分支数 + 1

41
Q

树 ——> 二叉树 的转换方法 :

42
Q

二叉树 ——> 树 的转换方法 :

43
Q

森林 ——> 二叉树 的转换方法 :

44
Q

二叉树 ——> 森林 的转换方法 :

45
Q

例题 :画线索二叉树

hint : 没有左孩子,连前驱;没有右孩子,连后继。两个都没有,就都要连

46
Q

AVL Tree : right & left rotation

47
Q

AVL Tree : LL & RR & LR & RL

48
Q

Categories of Tree : how to distinguish them?

49
Q

What does depth and height mean?

;
What’s the difference between them?

A

depth : The number of edges in the path from root node to the selected node.

height : The number of edges in the longest path connecting the selected node to any leaf node .