Exam 9: Searching and Sorting

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

What attributes should be stored in the TreeNode class?

Free
(Essay)
4.9/5
(46)
Correct Answer:
Verified

The TreeNode class must store a pointer to the element stored in that position as well as pointers to each of the children of that node. The class may also contain a pointer to the parent of the node.

  -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.

Free
(Short Answer)
4.8/5
(36)
Correct Answer:
Verified

PostOrder: A B D F C E

A node that does not have a parent is called the ______ of a tree.

Free
(Multiple Choice)
4.9/5
(33)
Correct Answer:
Verified

B

A node that has a parent is called the root of a tree.

(True/False)
4.9/5
(26)

  -Inorder traversal means ______. -Inorder traversal means ______.

(Short Answer)
4.9/5
(41)

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).

(True/False)
4.9/5
(34)

The binary tree shown above is complete.

(True/False)
4.8/5
(38)

We used a list to implement the iterator methods for a binary tree. What must be true for this strategy to be successful?

(Essay)
4.9/5
(36)

A collection where each node can have from 0 to 2 children is called a ______ Tree.

(Short Answer)
4.8/5
(37)

What is a tree?

(Short Answer)
4.8/5
(34)

  -Level-order traversal means ______. -Level-order traversal means ______.

(Short Answer)
4.8/5
(42)

There are four basic methods for traversing a tree: preorder, inorder, postorder, and level-order.

(Multiple Choice)
4.9/5
(39)

A tree is a nonlinear structure whose elements are organized into a hierarchy.

(True/False)
4.9/5
(37)

  -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 ______.

(Short Answer)
4.7/5
(23)

What is a node?

(Short Answer)
5.0/5
(40)

  -Postorder traversal means ______. -Postorder traversal means ______.

(Short Answer)
4.8/5
(44)

_________ traversal means visit the left child, then the node, then the right child.

(Multiple Choice)
4.9/5
(40)

  -For the tree shown above, list the leaves. -For the tree shown above, list the leaves.

(Short Answer)
4.9/5
(34)

Postorder traversal means visit the node, then the left child, then the right child.

(True/False)
4.8/5
(40)

Inorder traversal means visit the left child, then the node, then the right child.

(True/False)
4.8/5
(28)
Showing 1 - 20 of 54
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)