Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions