This is based off my other question. What is an array linked structure or node array?
I was trying to do this exercise
One of the responses to my other question asked me to ask my teacher to clarify what an array-linked hierarchy is. After I asked her, she said that it's just an array of nodes.
I think the array of nodes goes with what laune said, in that " is a technique that is used if you have a limited set of nodes of a fixed type, held in an array Node[] = new Node[CAPACITY], one field of Node being an int - the index. The payload is anything, as usual. You have, initially, all nodes in an avail list, linked 0->1->2->", with payload being the data that the node holds, which includes, the data and its links its holding .
So from all of that, this is what the data structure looks like in my head
public class NodeArray {
private ListNode[] elementData;
...
private class ListNode {
private int data;
private ListNode next;
....
}
}
What advantages dos this array of nodes data structure have to just regular linked list and array lists? I can't see a situation of why you would want a data structure like this. To me, its just another from of ArrayList because array lists are generic, their arrays could work with any type, including a list node.