



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Exam; Class: Algorithms; Subject: Computer Science; University: Eastern Washington University; Term: Spring 2009;
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!
A B E (^) F G H J C D A B C D E F G H J
Search tree with its left child (if one exists) and with its right child (if one exists)? Left child compares as less than the node, and the node compares as less than the right child.
that makes it an AVL tree rather than just a Binary Search Tree (BST)? At each AVL node, the heights of the two child nodes differ from each other by at most one. Printed 2020/ 12 月/4 at 12:54 Page 1 A B E (^) F G H J C D
Spring 2009: Exam 2
public class BSTnode { Comparable key; // Basis for ordering BSTnode left, // Reference to the left subtree right; // Reference to the right subtree.
int size (BSTnode t) { // and the rest is up to you!
nonascending order (that is, largest to smallest) to System.out, one per line. You are given the public method that calls the recursive method you are writing. public void reverseList() { if (root == null) System.out.println("Empty list"); else reverseList(root); } void reverseList ( BSTnode node ) { //and the rest is up to you
Spring 2009: Exam 2 First rotation at T
Second rotation of that tree at E R C a g T s v E d 20 25 40 49 50 58 63 70
Spring 2009: Exam 2
10. (5 points) Beginning with the above (valid) AVL tree, show (a) the tree resulting from inserting 30 , and then (b) the AVL tree, after corrections, if any are needed ,. If no corrections are needed, show expressly by the heights of the nodes why none are needed. Type 2 (LR) 20 25 40 49 50 58 63 70 30 20 25 40 49 50 58 63 70 30
question), show (a) the tree resulting from deleting 63 , and then (b) the AVL tree, after corrections, if any are needed. If no corrections are needed, show expressly by the heights of the nodes why none are needed.
odd for your answer. All nodes other than the root have at least m/2 -1 values ( m/2 children if non-leaf). The root has at least one value (and two children if a non-leaf node). All leaf nodes are at the same level. Type 1 (LL) 20 25 40 49 50 58 70 20 25 40 49 58 50 70