Question: Create an AVL Tree Map in java (AVLTreeMap.java). That is, create a map which depends on the self-balancing AVLTree. Below are five functions which need
Create an AVL Tree Map in java (AVLTreeMap.java). That is, create a map which depends on the self-balancing AVLTree. Below are five functions which need to be implemented into the program. The map interface (AVLTreeMap should implement Map.java) and Node class are also given. \\Map.java Interface
public interface Map { public int size(); public void put(String key, String value); public String get(String key); } \\AVLTreeMap.java
public class AVLTreeMap implements Map { class Node { String k; String val; int height; Node parent; Node left; Node right; public Node(String key, String value) { this.k = key; this.val = value; this.height = 1; this.parent = null; this.left = null; this.right = null; } public int balance() { // FIXME return -1; } } public AVLTreeMap() { // FIXME } public int size() { // FIXME return -1; } public void put(String key, String value) { // FIXME } public String get(String key) { // FIXME return null; } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
