Exam 17: Tree Structures

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Which of the following statements about inserting a node into a red-black tree is correct?

(Multiple Choice)
4.8/5
(33)

Consider the following tree diagrams: Consider the following tree diagrams:   Which tree represents the arithmetic expression (2 + 5) * 4? Which tree represents the arithmetic expression (2 + 5) * 4?

(Multiple Choice)
4.8/5
(30)

Consider the following tree diagram: Consider the following tree diagram:   Which arithmetic expression is represented by this tree? Which arithmetic expression is represented by this tree?

(Multiple Choice)
4.9/5
(34)

Which of the following is NOT a property of a red-black tree?

(Multiple Choice)
4.7/5
(54)

Given the BinarySearchTree and Node classes (partially shown below), select an expression to complete the recursive method smallest in the Node class.The method returns the smallest data value in the binary search tree rooted at a node. Given the BinarySearchTree and Node classes (partially shown below), select an expression to complete the recursive method smallest in the Node class.The method returns the smallest data value in the binary search tree rooted at a node.

(Multiple Choice)
4.7/5
(35)

In a binary search tree, where the root node data value = 45, what do we know about the values of all the descendants in the right subtree of the root?

(Multiple Choice)
4.8/5
(37)

Assuming that the variable t is instantiated to an empty BinarySearchTree, select a statement to complete the following code segment, so that the resulting binary search tree has a height of 4. Assuming that the variable t is instantiated to an empty BinarySearchTree, select a statement to complete the following code segment, so that the resulting binary search tree has a height of 4.

(Multiple Choice)
5.0/5
(43)

Consider the following binary search tree: Consider the following binary search tree:   Which of the following sequences correctly represents a depth-first traversal of this tree? Which of the following sequences correctly represents a depth-first traversal of this tree?

(Multiple Choice)
4.8/5
(37)

Which of the following statements about the three tree traversal schemes studied is correct?

(Multiple Choice)
4.8/5
(46)

What is the efficiency of adding an element to a red-black tree?

(Multiple Choice)
4.8/5
(46)

Which of the following statements about the heapsort algorithm is correct?

(Multiple Choice)
4.8/5
(44)

If the child references of a binary tree node are both null, the node is ____.

(Multiple Choice)
4.8/5
(35)

You wish to traverse a binary search tree using preorder traversal.Arrange the following actions in the correct order to accomplish this. i.Print the right subtree recursively II.Print the root III.Print the left subtree recursively

(Multiple Choice)
4.9/5
(42)

Consider the following binary search tree: Consider the following binary search tree:   Which of the following sequences correctly represents an inorder traversal of this tree? Which of the following sequences correctly represents an inorder traversal of this tree?

(Multiple Choice)
5.0/5
(31)

Consider the following tree diagram: Consider the following tree diagram:   Which of the following nodes are leaf nodes? Which of the following nodes are leaf nodes?

(Multiple Choice)
4.9/5
(37)

Consider the following binary search tree: Consider the following binary search tree:   Which of the following sequences correctly represents a preorder traversal of this tree? Which of the following sequences correctly represents a preorder traversal of this tree?

(Multiple Choice)
4.8/5
(37)

When we map a min-heap with n elements to an array with n + 1 elements, we ignore array element 0, and place the root value at which array index?

(Multiple Choice)
4.8/5
(37)

Which of the following statements about binary trees is correct?

(Multiple Choice)
4.8/5
(41)

Consider the following binary search tree diagram: Consider the following binary search tree diagram:   Consider the following addNode method for inserting a newNode into a binary search tree: public void addNode(Node newNode) { int comp = newnode.data.compareTo(data); if (comp < 0) { if (left == null) {left = newNode;} else { left.addNode(newNode); } } else { if (right == null) {right = newNode;} else { right.addNode(newNode); } } } Which of the following trees represents the correct result after inserting element B, calling addNode on the root of the tree?   Consider the following addNode method for inserting a newNode into a binary search tree: public void addNode(Node newNode) { int comp = newnode.data.compareTo(data); if (comp < 0) { if (left == null) {left = newNode;} else { left.addNode(newNode); } } else { if (right == null) {right = newNode;} else { right.addNode(newNode); } } } Which of the following trees represents the correct result after inserting element B, calling addNode on the root of the tree? Consider the following binary search tree diagram:   Consider the following addNode method for inserting a newNode into a binary search tree: public void addNode(Node newNode) { int comp = newnode.data.compareTo(data); if (comp < 0) { if (left == null) {left = newNode;} else { left.addNode(newNode); } } else { if (right == null) {right = newNode;} else { right.addNode(newNode); } } } Which of the following trees represents the correct result after inserting element B, calling addNode on the root of the tree?

(Multiple Choice)
4.8/5
(42)

Consider the following binary search tree: Consider the following binary search tree:   Which of the following sequences correctly represents a postorder traversal of this tree? Which of the following sequences correctly represents a postorder traversal of this tree?

(Multiple Choice)
4.9/5
(35)
Showing 21 - 40 of 102
close modal

Filters

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