Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is written in C++ Big-Oh Algorithm Complexities - Vector vs Linked List To be completed and Submitted for HW3 (15 pts) Task 1: (12

This is written in C++

image text in transcribed

Big-Oh Algorithm Complexities - Vector vs Linked List To be completed and Submitted for HW3 (15 pts) Task 1: (12 pts) Given the implementations of the Vector and Linked List abstract data types we studied in the lectures, indicate the algorithm time-complexity (in terms of numbers of significant operations) for each member function listed. (Functions parameters are omitted; consider them implicit). Provide your answers by placing 'X' into the applicable cell. Leave blank those cells with labels that do not apply. If there is a best case and worst case for a function, indicate both. If a function does not exist for one of Vector and List, indicate this with NA in the corresponding cells. List Vector O(1) 0(N) O(1) O(N) ::Size() :: empty() :: front() ::back() ::push_front() :: push_back() ::pop_front() pop_back() ::operator | :: begin ::endo :: find * *: regardless of whether our data structure has been implemented to include this function answer based of the most natural implementation you can think of for this task. Task 2: (3 pts) Explain in your own words the algorithm (= sequence of steps) you would use in order to implement a function Vector::pop_front() and a function List::operator [](int i). Although these functions are not provided in the Standard Template Library (STL) for vector and list, we could certainly create them. In your explanations above, state the likely (and good) reason why the STL does not include these functions. [continue on next page] Big-Oh Algorithm Complexities - Vector vs Linked List To be completed and Submitted for HW3 (15 pts) Task 1: (12 pts) Given the implementations of the Vector and Linked List abstract data types we studied in the lectures, indicate the algorithm time-complexity (in terms of numbers of significant operations) for each member function listed. (Functions parameters are omitted; consider them implicit). Provide your answers by placing 'X' into the applicable cell. Leave blank those cells with labels that do not apply. If there is a best case and worst case for a function, indicate both. If a function does not exist for one of Vector and List, indicate this with NA in the corresponding cells. List Vector O(1) 0(N) O(1) O(N) ::Size() :: empty() :: front() ::back() ::push_front() :: push_back() ::pop_front() pop_back() ::operator | :: begin ::endo :: find * *: regardless of whether our data structure has been implemented to include this function answer based of the most natural implementation you can think of for this task. Task 2: (3 pts) Explain in your own words the algorithm (= sequence of steps) you would use in order to implement a function Vector::pop_front() and a function List::operator [](int i). Although these functions are not provided in the Standard Template Library (STL) for vector and list, we could certainly create them. In your explanations above, state the likely (and good) reason why the STL does not include these functions. [continue on next page]

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

Step: 3

blur-text-image

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

4. Determine the significance of an F-ratio test statistic.

Answered: 1 week ago