Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me write this code about implementing an AVL tree using nodes in Java 8 . The question shows sample code in C++, but

Please help me write this code about implementing an AVL tree using nodes in Java 8. The question shows sample code in C++, but the final code should be written in Java 8. Please make sure that the code meets all the needed requirements. Also, include screenshots of your input and output. Thank You!

I HAVE POSTED THIS QUESTION MORE THAN 4 TIMES AND NO ONE HAS ANSWERED. PLEASE HELP ANSWER THIS.

-------------------------------------------------------------------------------------

image text in transcribed

You can find the Binary Search Tree (BST) Homework #1 code in Java here: pastebin.com/4bX8KY6D

image text in transcribedimage text in transcribedimage text in transcribed

-----------------------------------------------------------------------------------------------

These are the sample inputs entered and then the output that was outputted. Your output should match the sample outputs below after entering the sample inputs given.

Sample Input 0

17 insert 5 levelorder insert 3 levelorder insert 2 levelorder insert 9 levelorder insert 1 levelorder insert 7 levelorder insert 0 levelorder lookup 5 lookup 6 lookup 7 

Sample Output 0

5(0) 5(1) 3(0) 3(0) 2(0) 5(0) 3(-1) 2(0) 5(-1) 9(0) 3(0) 2(1) 5(-1) 1(0) 9(0) 3(0) 2(1) 7(0) 1(0) 5(0) 9(0) 3(0) 1(0) 7(0) 0(0) 2(0) 5(0) 9(0) 1 0 1 

Sample Input 1

23 insert 5 insert 3 insert 2 insert 9 insert 1 insert 7 insert 0 insert 15 insert 4 insert 8 levelorder delete 15 levelorder delete 8 levelorder delete 9 levelorder delete 0 levelorder lookup 15 lookup 23 lookup 9 lookup 5 

Sample Output 1

3(-1) 1(0) 7(0) 0(0) 2(0) 5(1) 9(0) 4(0) 8(0) 15(0) 3(-1) 1(0) 7(0) 0(0) 2(0) 5(1) 9(1) 4(0) 8(0) 3(-1) 1(0) 7(1) 0(0) 2(0) 5(1) 9(0) 4(0) 3(0) 1(0) 5(0) 0(0) 2(0) 4(0) 7(0) 3(0) 1(-1) 5(0) 2(0) 4(0) 7(0) 0 0 0 1
For this assignment, you will implement an AVL tree using nodes. For example, in C++, the node and class definitions would look like: struct Node { int data Node left; Node right; int height; d; class AVL Node root; 3; You will need to implement lookup, which returns a boolean indicating whether the target was found (this will be the same as for your BST in Homework #1), insert, which adds an item to the AVL tree, remove, which removes an item from the AVL, and a level-order traversal (which will also be the same as for your BST) which prints the tree in the appropriate order. For example, in C++, the function headers would be the following: For this assignment, you will implement an AVL tree using nodes. For example, in C++, the node and class definitions would look like: struct Node { int data Node left; Node right; int height; d; class AVL Node root; 3; You will need to implement lookup, which returns a boolean indicating whether the target was found (this will be the same as for your BST in Homework #1), insert, which adds an item to the AVL tree, remove, which removes an item from the AVL, and a level-order traversal (which will also be the same as for your BST) which prints the tree in the appropriate order. For example, in C++, the function headers would be the following

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

Step: 3

blur-text-image

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions