Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ Code We are going to compare the performance between Arrays and Link

ID: 3696042 • Letter: W

Question

Write a C++ Code

We are going to compare the performance between Arrays and Linked Lists. Please write C/C++ program following the procedure:
1. Suppose that N is 1000 (a number of data).
2. Generate N random numbers between 0 and 10000 (can be duplicated)
3. Store the numbers by using both an array and a Linked List.
4. Randomly select one index number between 0 and 200, and Add a random number to the index of the Array (or Linked List).
For the array, the following data of the index element should move to the right. I.e. you should consider the extra space when you declare the array, or you can specify the array size by using new/malloc.
5. Repeat (4) one hundred times (i.e., add 100 random numbers)
6. Compute the processing time of (4) and (5), and print it.
7. Now, repeat (1) – (6) setting N with 5000, 10000, and 20000.

Out put:-

The C/C++ program should print the progress and processing time (important). The output may look like:
-----------------------------------------------------------------------------
N = 1000
1) We are generating data (N=1000)
2) New data are being added
3) Processing time
Array: 5s
Linked List: 2s
--
N = 5000
1) We are generating data (N=5000)
2) New data are being added
3) Processing time
Array: 25s
Linked List: 10s
--
N = 10000
1) We are generating data (N=10000)
2) New data are being added
3) Processing time
Array: 250s
Linked List: 100s

Explanation / Answer

N = 20000

1) We are generating data (N=20000)

2) New data are being added

3) Processing time Array:

2500s

Linked List: 1000s

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote