Question
JAVA: Linked list problem I have a node class say: ************************************************ private static class Node { private int data; private Node right; private Node down;
JAVA: Linked list problem
I have a node class say:
************************************************
private static class Node {
private int data;
private Node right;
private Node down;
public Node(Node down, int data, Node right) {
this.down = down;
this.data = data;
this.right = right;
}
}
****************************************************************
I need to make a grid class whose constructor needs to links the rows and columns of the Nodes of for example a 5x4 grid.
so
public class Grid{
private Node head;
public Grid(){
//at (0,0), it would connect to all the nodes below it and all the nodes to the right of it. and so on and so on
//I'd also note it should be a circularly linked list.
}
}
anyhelp settting up that constructor would be appreciated. Lmk if you need more info
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