in c++ solve this Doubly Linked List question with use class not struct Find and Replace Write the nonmember function in
Posted: Thu May 05, 2022 1:17 pm
in c++ solve this Doubly Linked List question with use class not
struct
Find and Replace
Write
the nonmember 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.
struct
Find and Replace
Write
the nonmember 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.