Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please include an implementation header and main.cpp Create a sequence data structure using dynamic arrays. Sequence is similar to the bag but the order is

please include an implementation header and main.cpp image text in transcribed

Create a sequence data structure using dynamic arrays. Sequence is similar to the bag but the order is important in it (1, 2, 3 is different than 2, 1,3) Implement the erase first and erase last which respectively remove the first and the last occurrence of a value Implement the erase occurrence which removes the occurrence of a value (e.x. Erase the second occurrence of the value 4) Implement the erase from function which accepts INDEX of an element and erases the element f Implement the insert, count and size functions that respectively insert to the end of the sequence, count number of occurrence of a value and returns number of elements in the sequence Implement the insert first function Create a sequence data structure using dynamic arrays. Sequence is similar to the bag but the order is important in it (1, 2, 3 is different than 2, 1,3). Implement the erase_first and erase_last which respectively remove the first and the last occurrence of a value. Implement the erase_occurrence which removes the occurrence of a value (e.x. Erase the second occurrence of the value 4). Implement the erase_from function which accepts INDEX of an element and erases the element from that index (index starts from zero). Implement the insert, count and size functions that respectively insert to the end of the sequence, count number of occurrence of a value and returns number of elements in the sequence. Implement the insert_first function that insert an element as the first Index. Implement the insert_at function which insert some element at a specific index. If you have 3 values then you may have 4 places to insert at, for example if you have 1, 2, 3 and you want to insert 4 in the sequence, then you may insert at index 0, 1, 2 3 and the result will be 4, 1, 2, 3 or 1, 4, 2, 3 or 1, 2, 4, 3 or 1, 2, 3, 4 respectively. Implement the operator that connects two sequences and create the third one, Overload the + operator such that it connects a sequence to a number and return the result. *Implement the += as a member function that it will add a sequence to this sequence and the overloaded version which adds a number to this sequence. Implement the = operator this time try to return a sequence& instead of a sequence This is the most accurate version of the = operator). Implement the == operator which checks the equality of two sequences. Overload ostream (e.x. cout > s) operator so you may print a sequence or insert a sequence by console. In the main try to create a loop with 1,000,000,000 iterations. Try to create an instance of a sequence class in the loop and add one element to that. Run your program and check the memory usage. Add a destructor for to your sequence class and try the test again. What happens to the memory? Don't forget namespace and macro-guard

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions