I want to implement this interface Set using LinkedList and I no idea. can someone help me please.
Public interface Set{ public boolean insert(int i) public boolean remove(int i) public boolean member(int i) }
public class A1 { public static void main(String[] s1) { long time1; long time2; for (int i =1; i < 5; i++) { Set s = new LinkedSet(); int j = 0' time1 = System.CurrentTimeMillis(); for (; j < i * 4000; j++) { s.insert(j); } time2 = System.currentTimeMillis(); System.out.println("insertion of " + j + "elements takes " + (time2 - time1) + "milli seconds");
int k = 0; time1 = System.currentTimeMillis() for (; k < 1000; k++) { s.isMember(((int) (Math.random() * i * 10000)) %j); } time2 = System.currentTimeMillis(); System.out.println("isMember with " + j + "elements takes " + (((double) (time2 -time1)) / k) + "milli seconds"); time1 = System.currentTimeMillis(); for (j = 0; j < i * 4000; j++) { s.remove(j); } time2 = System.currentTimeMillis(); System.out.println("removal of " + j + "elements takes " + (time2 - time1) + "milli seconds"); } } }