Exam 22: Binary Trees, Avl Trees, and Priority Queues
Exam 1: Introduction to Computers and Java42 Questions
Exam 2: Java Fundamentals53 Questions
Exam 3: Decision Structures52 Questions
Exam 4: Loops and Files48 Questions
Exam 5: Methods50 Questions
Exam 6: A First Look at Classes49 Questions
Exam 7: A First Look at Gui Applications49 Questions
Exam 8: Arrays and the Arraylist Class52 Questions
Exam 9: A Second Look at Classes and Objects40 Questions
Exam 10: Text Processing and More About Wrapper Classes49 Questions
Exam 11: Inheritance49 Questions
Exam 12: Exceptions and Advanced File Io46 Questions
Exam 13: Advanced Gui Applications46 Questions
Exam 14: Applets and More39 Questions
Exam 15: Recursion34 Questions
Exam 16: Sorting, Searching, and Algorithm Analysis46 Questions
Exam 17: Generics50 Questions
Exam 18: Collections50 Questions
Exam 19: Array-Based Lists20 Questions
Exam 20: Linked Lists36 Questions
Exam 21: Stacks and Queues36 Questions
Exam 22: Binary Trees, Avl Trees, and Priority Queues45 Questions
Select questions type
Assuming a Node class
class Node
{
int element;
Node left,right;
Node(int el,Node left,Node right){
element = el;
this.left = left;
this.right = right;
}
}
Write a method int depth(Node tree)that returns the length of the longest path that begins at the node tree and ends at any leaf of the binary tree.
(Essay)
4.7/5
(41)
A binary tree stores items that have a natural order in such a way that at each node X,all items stored in the left subtree of X are less than the item stored at X,and all items stored in the right subtree are greater than the item stored at X.Such a binary tree is called
(Multiple Choice)
4.8/5
(43)
Let X be a node in a binary tree.Any node on the path from X to a leaf is called
(Multiple Choice)
4.8/5
(43)
Consider the operation of deleting the root of a binary search tree.If the root has two children,then
(Multiple Choice)
4.8/5
(40)
A complete binary tree with N nodes may be stored in an array A of length N by storing the root at A[0],and then storing in successive array locations the nodes of the tree in increasing order of the level of nodes.If nodes in the same level are stored in left to right order,then the node stored at A[k] will be a leaf if and only if
(Multiple Choice)
4.8/5
(41)
A complete binary tree with N nodes has depth approximately equal to
(Multiple Choice)
4.9/5
(38)
A binary tree traversal method that visits the root first,and then recursively traverses the left and right subtrees is called
(Multiple Choice)
4.7/5
(41)
A ternary tree is like a binary tree,except each node may have up to three successors.Write a TNode class that can be used to represent a ternary tree.Define a notion of preorder and postorder traversal for ternary trees,and write methods void postorder(TNode tree)and void preorder(TNode tree)that implements your notion of those traversals.
(Essay)
5.0/5
(50)
Let X be a node in a binary tree.The collection of all descendants of X
(Multiple Choice)
4.8/5
(30)
Showing 21 - 40 of 45
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)