Question
using this code i need help making a 2-3-4 tree in java. Which i insert keys in main method and print the tree //code public
using this code i need help making a 2-3-4 tree in java. Which i insert keys in main method and print the tree
//code
public class Node { private int[] keys; private Node[] children; private Node parent; private int size; private boolean isLeaf; public Node() { keys = new int[3]; children = new Node[4]; parent = null; size = 0; isLeaf = true; } public int getKey(int index) { return keys[index]; } public void setKey(int index, int key) { keys[index] = key; } public Node getChild(int index) { return children[index]; } public void setChild(int index, Node child) { children[index] = child; if (child != null) { child.setParent(this); } } public Node getParent() { return parent; } public void setParent(Node parent) { this.parent = parent; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public boolean isLeaf() { return isLeaf; } public void setLeaf(boolean isLeaf) { this.isLeaf = isLeaf; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started