Archived
The following recursive algorithm is used to calculate the Greatest Common Divisor of two numbers a and b (0<=b<=a and a=qb +r):
function calcPGCD(a, b)
{
If b = 0
{
display a;
}
Else
{
calcPGCD (b, a modulo b);
display ''calcPGCD('' +a+ '','' +b+'')'';
}
}
What does this code display when a is 21 and b is 15?
0
Community EvaluationsNo one has reviewed this question yet, be the first!
2
What do you call a structure whose data are nodes and linked together by oriented arcs?5
What does the While loop do?6
What is special about quick sort?2
What about the merge sort method?2
Given an array of 17 elements sorted in ascending order, what is the cost of accessing the element with index 10?9
What is recursion?6
What type of structure are the results of a recursive function stored in?