Question: Java question Say I have an array of size 5 and each index of the array has a header node that has been initialized as

Java question

Say I have an array of size 5 and each index of the array has a header node that has been initialized as array[i] = new Node(0,null) (basically an array of linked lists, each index has a linked list so a total of 5 linked lists )and I want to fill the array with 20 random integers.

The array has been initialized as type Node

Node [] array = new Node();

And I want to randomly select an index and fill the array with 20 random integers from a range of 1-10 (its okay if some linked lists have more integers than others)

So the output will look somehting like

Index Header Data

0 0 --> 5 --> 8 --> 9

1 0 --> 4 --> 5 --> 8

2 0 --> 6 --> 8 --> 10

3 0 --> 2 --> 4 --> 7

Header node will be 0 and the data is the numbers from 1-10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!