JAVA: Linked list problem I have a node class say: *****************************
ID: 3801383 • Letter: J
Question
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