Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please read the instructions carefully i need main.cpp sequence.cpp and sequence.h You need to use template classes to: 1. Do the assignment 3 with single
Please read the instructions carefully
i need main.cpp sequence.cpp and sequence.h
You need to use template classes to:
1. Do the assignment 3 with single connected linked list and make the value semantics safe to use.
2. Create iterator for your sequence class (You may need to modify the node class).
3. Do the assignment 3 with the doubly connected linked list. Do you see any advantage of doing that, write your answer as a comment on top of your main.cpp file.
send me a screenshot of the program running
Assignment 3 (Due on April 2) 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 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 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 for example if you 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 and istream (e.x. cin 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 and macro-guardStep 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