Question: 2 0 pts Write a segment of code that implements a functions called doSomething ( ) that takes in a list of words ( list
pts
Write a segment of code that implements a functions called doSomething that takes in a list of words list a string tr and the number of words n in list as arguments, and implements the logic described below.
doSomething searches for str in list and returns A NEW LIST containing all the words in list spelled backwards with the exception of the found string. If str is not found in list, then the NEW LIST is the same as list.
For instance, if list contains ABC "DEF", "GHI", JKL and str is "DEF", then the function returns a new list containing CBA "DEF", "IHG", LKJ and if str is not found in list, then the function returns a new list containing ABC "DEF", "GHI", JKLsame as the original list
Note:
You MUSTNOT modify the contents of list, nor can you use strcmp or strcpy However, you CAN use strlen
You MUST NOT use any array notation, ie
You MAY NOT assume each word in list is the same length.
You may assume at most a SINGLE OCCURENCE of str in list.
You may assume the call to the doSomething function is made elsewhere in the code. More precisely, provide the code segment that will go in the place indicated below.Edit Format Table pts
Write a segment of code that implements a functions called doSomething that takes in a list of words list a string tr and the number of words n in list as arguments, and implements the logic described below.
doSomething searches for str in list and returns A NEW LIST containing all the words in list spelled backwards with the exception of the found string. If str is not found in list, then the NEW LIST is the same as list.
For instance, if list contains ABC "DEF", "GHI", JKL and str is "DEF", then the function returns a new list containing CBA "DEF", "IHG", LKJ and if str is not found in list, then the function returns a new list containing ABC "DEF", "GHI", JKLsame as the original list
Note:
You MUSTNOT modify the contents of list, nor can you use strcmp or strcpy However, you CAN use strlen
You MUST NOT use any array notation, ie
You MAY NOT assume each word in list is the same length.
You may assume at most a SINGLE OCCURENCE of str in list.
You may assume the call to the doSomething function is made elsewhere in the code. More precisely, provide the code segment that will go in the place indicated below.Edit Format Table
Write a segment of code that implements a functions called dosomething that takes in a list of words list a string str and the number of words in list as arguments, and implements the logic described below.
doSomething searches for str in list and returns A NEW LIST containing all the words in list spelled backwards with the exception of the found string. If str is not found in list, then the NEW LIST is the same as list.
For instance, if list contains ABC "DEF", "GHI", JKL and str is "DEF", then the function returns a new list containing CBA "DEF", "IHG", LKJ and if str is not found in list, then the function returns a new list containing ABC "DEF", "GHI", JKLsame as the original list
Note:
You MUSTNOT modify the contents of list, nor can you use strcmp or strcpy However, you CAN use strlen
You MUST NOT use any array notation, ie
You MAY NOT assume each word in list is the same length.
You may assume at most a SINGLE OCCURENCE of str in list.
You may assume the call to the doSomething function is made elsewhere in the code. More precisely, provide the code segment that will go in the place indicated below.Edit Format Table
Write a segment of code that implements a functions called dosomething that takes in a list of words list a string str and the number of words in list as arguments, and implements the logic described below.
doSomething searches for str in list and returns A NEW LIST containing all the words in list spelled backwards with the exception of the found string. If str is not found in list, then the NEW LIST is the same as list.
For instance, if list contains ABC "DEF", "GHI", JKL and str is "DEF", then the function returns a new list containing CBA "DEF", "IHG", LKJ and if str is not found in list, then the function returns a new list containing ABC "DEF", "GHI", JKLsame as the original list
Note:
You MUSTNOT modify the contents of list, nor can you use strcmp or strcpy However, you CAN use strlen
You MUST NOT use any array notation, ie
You MAY NOT assume each word in list is the same length.
You may assume at most a SINGLE OCCURENCE of str in list.
You may assume the call to the doSomething function is made elsewhere in the code. More precisely, provide the code segment that will go in the place indicated below.Edit Format Table
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
