Q7Multiple correct6 Marks22 Dec 2024
Consider the procedure findSomething, that accepts a non-empty list of integers L as input. Which of the following statements is/are true? It is a Multiple Select Question (MSQ).
Procedure findSomething(L)
if(length(L) == 1){
return(first(L))
}
else{
if(first(L) > last(L)){
return(findSomething(init(L)))
}
else{
return(findSomething(rest(L)))
}
}
End findSomething
Topic Mapping: chapter: Week 9 │ topic: Recursion — Self-referential Algorithms │ subtopic: Recursive maximum-finding algorithm on lists using divide-and-conquer strategy