Sample Run

assignment description

This file shows the expected output of the ListComparisons program.

Note: the numbers you get are going to be different.

The original program's output

This program compares the time it takes for ArrayLists and LinkedLists to do the equivalent things. Original program: Mark Young (A00000000) ...press enter... Time to build up and then empty a list. N ArrayList(N) LinkedList(N) ---------- ------------ ------------- 10 11,600 14,400 100 73,800 42,600 1,000 521,700 425,000 10,000 2,877,300 1,204,100 100,000 310,566,200 2,410,900 Time to build up and then randomly access elements of a list. N ArrayList(N) LinkedList(N) ---------- ------------ ------------- 10 25,700 17,700 100 70,800 86,700 1,000 290,500 571,100 10,000 1,509,800 22,392,500 100,000 6,532,700 2,017,585,700 Elapsed time: 2.5 seconds.

The version with smaller multiplier and maximum

This program compares the time it takes for ArrayLists and LinkedLists to do the equivalent things. Original program: Mark Young (A00000000) ...press enter... Time to build up and then empty a list. N ArrayList(N) LinkedList(N) ---------- ------------ ------------- 10 13,200 14,100 80 81,100 43,600 640 378,900 364,200 5,120 4,276,000 1,849,900 40,960 53,417,400 1,521,100 Time to build up and then randomly access elements of a list. N ArrayList(N) LinkedList(N) ---------- ------------ ------------- 10 29,300 18,500 80 108,400 103,500 640 344,000 381,300 5,120 1,217,500 10,562,700 40,960 4,374,700 334,004,900 Elapsed time: 0.4 seconds.

The revised program's output

This program compares the time it takes for ArrayLists and LinkedLists to do the equivalent things. Original program: Mark Young (A00000000) Modified to run each test 10 times and average the results, and to calculate the ratio of the two times. Revised program: Mark Young (A00000000) ...press enter... Time to build up and then empty a list. N ArrayList(N) LinkedList(N) A / L L / A ---------- ------------ ------------- ----- ----- 10 7,160 6,420 1.12 0.90 100 44,730 41,240 1.08 0.92 1,000 246,500 194,360 1.27 0.79 10,000 2,741,360 906,520 3.02 0.33 100,000 323,360,720 3,454,350 93.61 0.01 Time to build up and then randomly access elements of a list. N ArrayList(N) LinkedList(N) A / L L / A ---------- ------------ ------------- ----- ----- 10 10,560 10,350 1.02 0.98 100 35,110 38,260 0.92 1.09 1,000 173,980 398,390 0.44 2.29 10,000 1,959,790 21,364,220 0.09 10.90 100,000 6,726,020 1,876,212,780 0.00 278.95 Elapsed time: 22.1 seconds.

Return to Outline page / assignment description