Question: 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
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 c (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;}
}
//******************************************************************************* // 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
