L08b

Due by the end of this meeting

Starter Files:


SUBMIT   /   Submission Summary

Comparing ArrayLists and LinkedLists using Timing Data

Activity 1
Consider the ListComparisons program from A06. Revise it to include a method passRate(int numElts, Random rand, List<Integer> list). This method generates a list of numElts values using rand.nextInt(101). It then goes thru all those numbers counting how many are gretaer than or equal to 50. (It neither prints nor returns the count! I just want it to do the counting. Compare the randomAccess method.)
Activity 2
Create a method testPassRate that compares how long it takes to count the passing grades using an ArrayList versus a LinkedList. (Base it on testRandomAccess.)

Call this method from main (right after testRandomAccess). Run the program several times, and add a comment (in main right after the call to testPassRate) saying whether ArrayLists or LinkedLists are faster, or whether they're about the same.

Your grade will be based on the following rubric:

Submit this/these files:


SUBMIT   /   Submission Summary