Select the programming task that requires recursion. Creating a list of all of the anagrams of a word Reversing the order of words in a list Searching for a word in a list by comparing all words in the list from first to last Searching for a word in a list by repeatedly splitting it into smaller, equally sized list
Reversing the words in a list doesn't require recursion, just use a loop searching in a list word by word can also be done with a loop creating a list of all anagrams should be done by recursion searching word by repeatedly splitting should also be done by recursion But I think recursion is usually used to make a problem smaller and smaller which is why you have a base case and a recursive case. So I think it's the last one
Ok thanks
You can do all of these without recursion. 1) use something like \(\href{https://en.cppreference.com/w/cpp/algorithm/next_permutation}{next\_permutation}\) in c++ for generating anagrams. You can have a look at how it's implemented. no recursion 2 and 3) simple loop. no recursion 4) sort the list and use binary search. no recursion
Hmmmm ok so do you agree that the answer is D.)
No, I don't. There are various algorithms to implement the given tasks, and not all of them require recursion. You probably need to answer this, keeping in mind the algorithms you've been taught in the class.
Ok
Thanks
Join our real-time social learning platform and learn together with your friends!