1- Write the non-member function int replaceVal(DLList<T> &list, T f, T r) which replaces every occurrence of the value f in the list with the value r. The function should also return the total number of replacements.
Example: If the list myList has [7, 3, 5, 7, 7, 3, 8, 3], then after calling replaceVal(myList, 7, 5); myList will contain [5, 3, 5, 5, 5, 3, 8, 3]. The function returns 3.
2- Write the DLList member function DLList rmv_ret_negative() which should remove nodes with negative values from the original list, add them to another temporary list, and return that list.
Example: If the list list1 has [10, -5, -2, 20, 90, -25, 50], then after calling: list1.rmv_ret_negative(), list1 should contain [10, 20, 90, 50].
3- Write the DLList member function void DLList<T>::RemoveAllDuplicatesOf(T& x) function, which deletes all the occurrences of x (but one) in a sorted DLL.
Example: If the current list is [5, 7, 7, 7, 10, 15, 25, 25], then calling: RemoveAllDuplicatesOf(7); will change the current list to [5, 7, 10, 15, 25, 25].
*For full credit, your implementation should efficiently search and not use extra space.
4- Write the DLList member function DLLNode<T>* DLLidt<T>::get_at(int index) function that returns the node at a specific index in the list.
5- Write the DLList member function bool DLLidt<T>::insert_before(int index, T& x) that is going to insert a node with the value of x before the node at position index in the list.
Example: If the current list is [5, 6, 7, 8], insert_before(2,0); will change the current list to [5, 6, 0, 7, 8].
**You need to use the get_at function, and use it only one time to optimize the call of your code.
**Don't forget to fix the next and prev pointers for each node.
**For inserting before the 0 index, you may use the add_to_head function.
6- Write a main driver that tests all the newly implemented functions, use your own cases, and don't use the example from this document.
7- Don't forget to submit the report and the code (.h and .cpp).