Question: I need help implementing the method isBinaryTree in JAVA. To check if an array encodes a binary tree . CODE: import java.util.List; import java.util.ArrayList; public
I need help implementing the method isBinaryTree in JAVA. To check if an array encodes a binary tree .
CODE:
import java.util.List;
import java.util.ArrayList;
public class ArrayHeapChecker {
/*
* This nested class contains a completed implementation of Entry.
*
* You do not need to edit this class.
*/
public static class Entry
private K key;
private V value;
public Entry(K key, V value) {
this.key = key;
this.value = value;
}
public K getKey() {return key;}
public V getValue() {return value;}
public void setKey(K key) {this.key = key;}
public void setValue(V value) {this.value = value;}
}
/**
* Checks if the given array is a representation of a binary tree.
*
* @param entries
* array of entries to be tested
*
* @return true if the input array encodes a binary tree, false otherwise
*/
public static
// TODO: implement this
return true;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
