MABS Institution
11th Computer Science Weekly Test -2 ( Iteration and recursion )-Aug 2020
-
-
-
-
What is recursive problem solving
-
Define a loop invariant.
-
Explain how will you solve a problem recursively.
-
Explain the outline of recursive problem-solving technique.
-
There are 6 equally spaced trees and 6 sparrows sitting on these trees,one sparrow on each tree. If a sparrow flies from one tree to another, then at the same time, another sparrow flies from its tree to some other tree the same distance away, but in the opposite direction. Is it possible for all the sparrows to gather on one tree?
-
Customers are waiting in a line at a counter. The man at the counter wants to know how many customers are waiting in the line.
-
Explain Loop invariant with a neat diagram.
-
Power can also be defined recursively as \({ a }^{ n }=\begin{cases} 1\quad \quad \quad \quad \quad \quad ifn=0 \\ a\times { a }^{ n }-1\quad \quad ifn\quad is\quad odd \\ { a }^{ n/2 }\times an/2\quad ifn\quad is\quad even \end{cases}\) Construct a recursive algorithm using this definition. How many multiplications are needed to calculate a10?