Question: c++ Write code that uses DynArr to allocate and insert a large number of elements into a DynArt object. Use std::clock to measure the time

 c++ Write code that uses DynArr to allocate and insert a

c++

Write code that uses DynArr to allocate and insert a large number of elements into a DynArt object. Use std::clock to measure the time needed to insert 1000, 2000, 3000, 4000, 5000, 200000 elements into the DynArr object. Change the way the array is expanded and instead of doubling the capacity only increase the capacity by 10. Repeat measuring the time for 1000, 2000, ... 200000 insertions. What difference do you notice? Try to explain. Hint: try to chart the two sequences. Repeat the same exercise but now use the STL vector class instead of Dynrr. Use the push_back method to insert the elements. Compare the behavior of the vector insertions with the DynArr (with double growth) insertions. Try to explain the difference in runtime behavior if any

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!