Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need the sequence.cpp sequence.h and main.cpp file please give me a running code Create a sequence data structure using dynamic arrays. Sequence is similar
I need the sequence.cpp sequence.h and main.cpp file please give me a running code
Create a sequence data structure using dynamic arrays. Sequence is similar to the bog but the order is important in It (1, 2, 3 is d 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 sequences& 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. *You will be familiar with these operators in the next class, however, it is better to start your homework nowStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started