manju
Posted in : Java Beginners

May 20, 2008 at 1:51 PM

Hi

import java.util.*;

static final int N = 10000;
static List values;
static {
Integer vals[] = new Integer[N];
Random rn = new Random();
for (int i = 0, currval = 0; i < N; i++) {
vals[i] = new Integer(currval);
currval += rn.nextInt(100) + 1;
}
values = Arrays.asList(vals);
}

static long timeList(List lst){
long start = System.currentTimeMillis();

for (int i = 0; i < N; i++) {
// look up a value in the list
// using binary search

int indx = Collections.binarySearch(lst, values.get(i));
if (indx != i) {
}
}
return System.currentTimeMillis() - start;
}

public static void main(String args[]) {
System.out.println("Time for ArrayList = " +timeList(new ArrayList(values)));
}
}

-------------------------------------------------

java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent!!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
Core java linked list example  What is the real time example for linked list
linked list in java - Java Beginners
linked list in java  Hi, how to implement linked list in java using... information. http://www.roseindia.net/java/beginners/linked-list-demo.shtml...; static List values; static { Integer vals[] = new Integer[N]; Random rn = new
linked list  hi i have basal problem what is the linked list
delete a node from singly linked list in java
delete a node from singly linked list in java  Write a program(in java), if given a pointer to a node (not the tail node) in a singly linked list, delete that node from the linked list.   could you tell your question
creating java linked list - Java Beginners
creating java linked list  how can one create a sorted linked list. thats adding it to the queue? thans in advance.  Hi , import...("Size of list: " + queue.size()); System.out.println("Queue head using peek
linked list   how to add student and mark and number from file in linked list and print them also how to make search function plz can help me sooon
program to manage the registration details for the institute. 1. Use a linked list to manage the details of all registered students. a. Create your own linked list...linked list  Data Structures An English institute has a different
in the following logical linked list represents Computer Number. 76(head) 98 54...? to ?66?. The segment should also display the new contents of the linked list. ii. Write a program segment to copy all ?Dell? computers to a new linked list
linked list example problem - Java Beginners
linked list example problem - Java Beginners
HELP Generic linked list  How to create Generic linked list example program in Java
Multiplication of two polynomials using linked list in java
Multiplication of two polynomials using linked list in java  I am doing a program "Multiplication of two polynomials using linked list in java... for polynomial linked list import java.util.Scanner; class Node { public int
write a java pogram to add elements to linked list using keyboard and display it
write a java pogram to add elements to linked list using keyboard and display it  write a java pogram to add elements to linked list using keyboard and display
Linked list implementation  How to create linkedlist by using array in java? and also How to manipulate