Generate 20 million random numbers, one at a time, and insert them into an array that doubles every time it runs out of space (starting size of 2), into an array that can hold 20 million elements from creation, and a linked list that can hold 20 million elements

Generate 20 million random numbers, one at a time, and insert them into an array that doubles every time it runs out of space (starting size of 2), into an array that can hold 20 million elements from creation, and a linked list that can hold 20 million elements

Programming

Subject or discipline:     Computer science

Write a program (including timing measurements) for the following scenario.  Generate 20 million random numbers, one at a time, and insert them into an array that doubles every time it runs out of space (starting size of 2), into an array that can hold 20 million elements from creation, and a linked list that can hold 20 million elements.  You should do this both for integers and floating point numbers.  (The numbers should be regular integers or floats).  Compare the time required for each of the six scenarios, and explain the differences.  You will need to write your own way to double an array size (it’s up to you how to do this), don’t use an ArrayList.

b) Do a brute force in order search through each of these to find the largest number.  Again, compare the timings for all 6 scenarios.

Is this the question you were looking for? If so, place your order here to get started!