Question
Please solve using JAVA as soon as possible and show the OUTPUT! Thanks in advance Below is Linked list client code: //************************************************************************ ******* // FILE
Please solve using JAVA as soon as possible and show the OUTPUT!
Thanks in advance
Below is Linked list client code:
//************************************************************************
*******
// FILE NAME : LLIntcollTest.java
// DESCRIPTION : This file tests Intcoll4 - the linked list version of
Intcoll.
//************************************************************************
*******
import java.util.*;
import java.io.*;
public class LLIntcollTest
{
public static void main(String[] args)
{
System.out.println("Enter # of random integers to be generated");
Scanner blackboard=new Scanner(System.in);
int n=blackboard.nextInt();
Intcoll4 LL=new Intcoll4(n);
Random gen=new Random(); long lapse=0, begin, end; int k=0;
while (k
{
int i=5*(gen.nextInt(n)+1);
begin=System.currentTimeMillis();
LL.insert(i);
end=System.currentTimeMillis();
lapse=lapse+(end-begin);
k++;
}
System.out.println("The # of integers in LL is "+LL.get_howmany());
System.out.println("Time in milliseconds "+lapse);
}
}
Create intcoll4 and run our intcoll4client using intcoll4. In this 4th version, intcoll4, the integers in a collection are stored in a linked list whose name is the private member o (using the inner class ListNode). Also, how many is still a private member. // The inner class for ListNode private class ListNode private int info; private ListNode link; public ListNode) info-0; link null public ListNode(int i, ListNode p) \info-i; link -p:)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