Deck 9: Searching and Sorting

Full screen (f)
exit full mode
Question
A collection where each node can have from 0 to 2 children is called a ___________.

A) Stack
B) Queue
C) List
D) Binary tree
Use Space or
up arrow
down arrow
to flip the card.
Question
A node that does not have a parent is called the ______ of a tree.

A) foot
B) root
C) leaf
D) top
Question
A tree is a nonlinear structure whose elements are organized into a __________.

A) stack
B) hierarchy
C) queue
D) list
Question
The simulated link strategy allows array positions to be allocated contiguously regardless of the _________ of the tree.

A) size
B) order
C) completeness
D) root
Question
In general, a balanced n-ary tree with m elements will have height _______.

A) lognm
B) logmm
C) logmn
D) lognn
Question
There are four basic methods for traversing a tree: preorder, inorder, postorder, and level-order.

A) Top down, bottom up, inorder, and postorder
B) Top down, inorder, postorder, and level-order
C) Bottom up, preorder, in order, and postorder
D) preorder, inorder, postorder, and level-order
Question
_________ traversal means visit the node, then the left child, then the right child.

A) preorder
B) postorder
C) inorder
D) level-order
Question
_________ traversal means visit the left child, then the node, then the right child.

A) preorder
B) postorder
C) inorder
D) level-order
Question
________ traversal means visit the left child, then the right child, then the node.

A) preorder
B) postorder
C) inorder
D) level-order
Question
___________ traversal means visit the nodes at each level, one level at at time, starting with the root.

A) preorder
B) postorder
C) inorder
D) level-order
Question
In the computational strategy to implement a tree with an array, the children of node n are stored at 2n + 1 and 2(n + 1) respectively.

A) 2n + 1
B) 2n + 2
C) 2(n + 1)
D) A and B
E) A and C
F) B and C
Question
A node that does not have a ______ is called the root of a tree.
Question
A collection where each node can have from 0 to 2 children is called a ______ Tree.
Question
A node that has both a parent and at least one child is called a(n) ______ node.
Question
A balanced N-ary tree with n elements will have height ______.
Question
  -For the tree shown above, list the root.<div style=padding-top: 35px>
-For the tree shown above, list the root.
Question
  -For the tree shown above, list the leaves.<div style=padding-top: 35px>
-For the tree shown above, list the leaves.
Question
  -What is the height of the tree shown above?<div style=padding-top: 35px>
-What is the height of the tree shown above?
Question
  -For the binary tree shown, list the elements in the order generated by an InOrder traversal.<div style=padding-top: 35px>
-For the binary tree shown, list the elements in the order generated by an InOrder traversal.
Question
  -For the binary tree shown, list the elements in the order generated by an PreOrder traversal.<div style=padding-top: 35px>
-For the binary tree shown, list the elements in the order generated by an PreOrder traversal.
Question
  -For the binary tree shown, list the elements in the order generated by an PostOrder traversal.<div style=padding-top: 35px>
-For the binary tree shown, list the elements in the order generated by an PostOrder traversal.
Question
  -A ______ is a nonlinear structure whose elements are organized into a hierarchy.<div style=padding-top: 35px>
-A ______ is a nonlinear structure whose elements are organized into a hierarchy.
Question
  -The ______ strategy allows array positions to be allocated contiguously regardless of the completeness of the tree.<div style=padding-top: 35px>
-The ______ strategy allows array positions to be allocated contiguously regardless of the completeness of the tree.
Question
  -In general, a balanced n-ary tree with m elements will have height ______.<div style=padding-top: 35px>
-In general, a balanced n-ary tree with m elements will have height ______.
Question
  -There are four basic methods for traversing a tree: ______.<div style=padding-top: 35px>
-There are four basic methods for traversing a tree: ______.
Question
  -Preorder traversal means ______.<div style=padding-top: 35px>
-Preorder traversal means ______.
Question
  -Inorder traversal means ______.<div style=padding-top: 35px>
-Inorder traversal means ______.
Question
  -Postorder traversal means ______.<div style=padding-top: 35px>
-Postorder traversal means ______.
Question
  -Level-order traversal means ______.<div style=padding-top: 35px>
-Level-order traversal means ______.
Question
  -In the computational strategy to implement a tree with an array, the children of node n are stored at _____.<div style=padding-top: 35px>
-In the computational strategy to implement a tree with an array, the children of node n are stored at _____.
Question
The binary tree shown above is balanced.
Question
The binary tree shown above is complete.
Question
A collection where each node can have from 0 to 3 children is called a Binary Tree.
Question
A find operation on a balanced binary search tree is O(logn) where as a find operation for binary search tree without the balance assumption is O(n).
Question
A node that has a parent is called the root of a tree.
Question
A tree is a nonlinear structure whose elements are organized into a hierarchy.
Question
The simulated link strategy does not allow array positions to be allocated contiguously regardless of the completeness of the tree.
Question
In general, a balanced n-ary tree with m elements will have height lognm.
Question
Preorder traversal means visit the left child, then the right child, then the node.
Question
Inorder traversal means visit the left child, then the node, then the right child.
Question
Postorder traversal means visit the node, then the left child, then the right child.
Question
Level-order traversal means visit the nodes at each level, one level at at time, starting with the root.
Question
In the computational strategy to implement a tree with an array, the children of node n are stored at 2n + 1 and 2(n + 1) respectively.
Question
What is a tree?
Question
What is a node?
Question
What is the root of the tree?
Question
What is a leaf?
Question
Define the height of a tree.
Question
Define the level of a node.
Question
What are the advantages and disadvantages of the computational strategy?
Question
What are the advantages and disadvantages of the simulated link strategy?
Question
What attributes should be stored in the TreeNode class?
Question
Which method of traversing a tree would result in a sorted list for a binary search tree?
Question
We used a list to implement the iterator methods for a binary tree. What must be true for this strategy to be successful?
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/54
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 9: Searching and Sorting
1
A collection where each node can have from 0 to 2 children is called a ___________.

A) Stack
B) Queue
C) List
D) Binary tree
Binary tree
2
A node that does not have a parent is called the ______ of a tree.

A) foot
B) root
C) leaf
D) top
root
3
A tree is a nonlinear structure whose elements are organized into a __________.

A) stack
B) hierarchy
C) queue
D) list
hierarchy
4
The simulated link strategy allows array positions to be allocated contiguously regardless of the _________ of the tree.

A) size
B) order
C) completeness
D) root
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
5
In general, a balanced n-ary tree with m elements will have height _______.

A) lognm
B) logmm
C) logmn
D) lognn
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
6
There are four basic methods for traversing a tree: preorder, inorder, postorder, and level-order.

A) Top down, bottom up, inorder, and postorder
B) Top down, inorder, postorder, and level-order
C) Bottom up, preorder, in order, and postorder
D) preorder, inorder, postorder, and level-order
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
7
_________ traversal means visit the node, then the left child, then the right child.

A) preorder
B) postorder
C) inorder
D) level-order
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
8
_________ traversal means visit the left child, then the node, then the right child.

A) preorder
B) postorder
C) inorder
D) level-order
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
9
________ traversal means visit the left child, then the right child, then the node.

A) preorder
B) postorder
C) inorder
D) level-order
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
10
___________ traversal means visit the nodes at each level, one level at at time, starting with the root.

A) preorder
B) postorder
C) inorder
D) level-order
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
11
In the computational strategy to implement a tree with an array, the children of node n are stored at 2n + 1 and 2(n + 1) respectively.

A) 2n + 1
B) 2n + 2
C) 2(n + 1)
D) A and B
E) A and C
F) B and C
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
12
A node that does not have a ______ is called the root of a tree.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
13
A collection where each node can have from 0 to 2 children is called a ______ Tree.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
14
A node that has both a parent and at least one child is called a(n) ______ node.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
15
A balanced N-ary tree with n elements will have height ______.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
16
  -For the tree shown above, list the root.
-For the tree shown above, list the root.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
17
  -For the tree shown above, list the leaves.
-For the tree shown above, list the leaves.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
18
  -What is the height of the tree shown above?
-What is the height of the tree shown above?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
19
  -For the binary tree shown, list the elements in the order generated by an InOrder traversal.
-For the binary tree shown, list the elements in the order generated by an InOrder traversal.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
20
  -For the binary tree shown, list the elements in the order generated by an PreOrder traversal.
-For the binary tree shown, list the elements in the order generated by an PreOrder traversal.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
21
  -For the binary tree shown, list the elements in the order generated by an PostOrder traversal.
-For the binary tree shown, list the elements in the order generated by an PostOrder traversal.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
22
  -A ______ is a nonlinear structure whose elements are organized into a hierarchy.
-A ______ is a nonlinear structure whose elements are organized into a hierarchy.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
23
  -The ______ strategy allows array positions to be allocated contiguously regardless of the completeness of the tree.
-The ______ strategy allows array positions to be allocated contiguously regardless of the completeness of the tree.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
24
  -In general, a balanced n-ary tree with m elements will have height ______.
-In general, a balanced n-ary tree with m elements will have height ______.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
25
  -There are four basic methods for traversing a tree: ______.
-There are four basic methods for traversing a tree: ______.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
26
  -Preorder traversal means ______.
-Preorder traversal means ______.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
27
  -Inorder traversal means ______.
-Inorder traversal means ______.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
28
  -Postorder traversal means ______.
-Postorder traversal means ______.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
29
  -Level-order traversal means ______.
-Level-order traversal means ______.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
30
  -In the computational strategy to implement a tree with an array, the children of node n are stored at _____.
-In the computational strategy to implement a tree with an array, the children of node n are stored at _____.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
31
The binary tree shown above is balanced.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
32
The binary tree shown above is complete.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
33
A collection where each node can have from 0 to 3 children is called a Binary Tree.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
34
A find operation on a balanced binary search tree is O(logn) where as a find operation for binary search tree without the balance assumption is O(n).
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
35
A node that has a parent is called the root of a tree.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
36
A tree is a nonlinear structure whose elements are organized into a hierarchy.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
37
The simulated link strategy does not allow array positions to be allocated contiguously regardless of the completeness of the tree.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
38
In general, a balanced n-ary tree with m elements will have height lognm.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
39
Preorder traversal means visit the left child, then the right child, then the node.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
40
Inorder traversal means visit the left child, then the node, then the right child.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
41
Postorder traversal means visit the node, then the left child, then the right child.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
42
Level-order traversal means visit the nodes at each level, one level at at time, starting with the root.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
43
In the computational strategy to implement a tree with an array, the children of node n are stored at 2n + 1 and 2(n + 1) respectively.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
44
What is a tree?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
45
What is a node?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
46
What is the root of the tree?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
47
What is a leaf?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
48
Define the height of a tree.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
49
Define the level of a node.
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
50
What are the advantages and disadvantages of the computational strategy?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
51
What are the advantages and disadvantages of the simulated link strategy?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
52
What attributes should be stored in the TreeNode class?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
53
Which method of traversing a tree would result in a sorted list for a binary search tree?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
54
We used a list to implement the iterator methods for a binary tree. What must be true for this strategy to be successful?
Unlock Deck
Unlock for access to all 54 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 54 flashcards in this deck.