What is the algorithm used in the following code?
int algo(int a, int b)
{
if (a == 0) return b;
if (b == 0) return a;
if (a == b) return a;
if (a > b) return algo(a-b, b);
return algo(a, b-a);
}
a. Recursive
b. Graph
c. Greedy
d. Dynamic programming
a. Recursive
The algorithm shows the greatest common denominator evaluation that is recursive.
You might also like to view...
________ testing consists of testing an application with a user prior to releasing an application for wider use
Fill in the blank(s) with correct word
The emitter and collector are the two input lines of a transistor.
Answer the following statement true (T) or false (F)
Answer the following statement(s) true (T) or false (F)
Type 1 hypervisors are usually the ones you find loaded on a suspect machine.
Which of the following is a reason to use dynamic DNS?
A. The host IP address is not listed in the firewall. B. The host IP address is assigned by DHCP. C. Static routes cannot be used on the host network. D. A third-party certificate is being used.