Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

37,(16 6 points) In the AVLT nd he method dnable winb ncthods to doubleRetation nodes when calling deuble the double The method antor case 2

image text in transcribed
37,(16 6 points) In the AVLT nd he method dnable winb ncthods to doubleRetation nodes when calling deuble the double The method antor case 2 and 3,the AVI Tree class can Rotation foe case 2 and whom Rotation has three pranetenk1. k2. k', esch ponting to%; colling deublcRotation for case Here are all the methods from the code for this question the AVL Tree class and its nesod Node class which you might need ow public class AVLTree nytype vate static clasa Sode Anytypex publie ModecAnyTypes get Lefto (return left 1 publie sodecAnrrype> getRight (.{ return right:) publie int geteight O return height public void setLeft (Node AnyTypes 1)(left-1 public void setRight (Node cAnytype right public void setheight (int h) (heighth vate int getheight (NodeAnytype t) return (ul17-1t.getHeight 03 rivate void setheight (Node-AnyTypes t) int left ChildHeight getHeight (e.getLeft0) int rightChildHeight getHeight (t.getRight 0) . rightchadieight) t.setile ight (Math.nax (1 ef t Childieight. performs a double rotation for case 2. The variable t is the root of the subtree that noods to be rebalanced Fill in the three parameters for deuble Rotation on the line below so that it will perform a double rotation for case 2 a. In the Balance method the call to deubleRetation will replace the call to dowbleWithLeftChild which t -doubleRotation ( In the Balance method the call to doubleRotation will replace the call to doubleWithRightChild which performs a double rotation for case 3. The variable t is the root of the subtree that needs to be rebalanced. Fill in the three parameters for doubleRotation on the line below so that it will perform a double rotation for case 3, tdoubleRotation ( 37,(16 6 points) In the AVLT nd he method dnable winb ncthods to doubleRetation nodes when calling deuble the double The method antor case 2 and 3,the AVI Tree class can Rotation foe case 2 and whom Rotation has three pranetenk1. k2. k', esch ponting to%; colling deublcRotation for case Here are all the methods from the code for this question the AVL Tree class and its nesod Node class which you might need ow public class AVLTree nytype vate static clasa Sode Anytypex publie ModecAnyTypes get Lefto (return left 1 publie sodecAnrrype> getRight (.{ return right:) publie int geteight O return height public void setLeft (Node AnyTypes 1)(left-1 public void setRight (Node cAnytype right public void setheight (int h) (heighth vate int getheight (NodeAnytype t) return (ul17-1t.getHeight 03 rivate void setheight (Node-AnyTypes t) int left ChildHeight getHeight (e.getLeft0) int rightChildHeight getHeight (t.getRight 0) . rightchadieight) t.setile ight (Math.nax (1 ef t Childieight. performs a double rotation for case 2. The variable t is the root of the subtree that noods to be rebalanced Fill in the three parameters for deuble Rotation on the line below so that it will perform a double rotation for case 2 a. In the Balance method the call to deubleRetation will replace the call to dowbleWithLeftChild which t -doubleRotation ( In the Balance method the call to doubleRotation will replace the call to doubleWithRightChild which performs a double rotation for case 3. The variable t is the root of the subtree that needs to be rebalanced. Fill in the three parameters for doubleRotation on the line below so that it will perform a double rotation for case 3, tdoubleRotation (

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions