int SomeFunction(int x, int y)
{
if ((x == 1) || (y == 1)) return 1;
if (x == y) return x;
if (x > y) return SomeFunction(x - y, y);
if (y > x) return SomeFunction(x, y - x);
}Related Programming & Data Structures PYQs
A binary search tree T contains n distinct elements. What is the time complexity of picking an element in T that is smaller than t…
Consider the following sequence of operations on an empty stack. push(54); push(52); pop(); push(55); push(62); s = pop(); Conside…
Consider the following ANSI C program. ```c #include <stdio.h> int main() { int i, j, count; count = 0; i = 0; for (j = -3…
Consider the following ANSI C function: ```c int SimpleFunction(int Y[], int n, int x) { int total = Y[0], loopIndex; for (loo…
Let H be a binary min-heap consisting of n elements implemented as an array. What is the worst case time complexity of an optimal …
Consider the following ANSI C program. ```c #include <stdio.h> int main(){ int arr[4][5]; int i, j; for (i=0; i<4; i++){ …
Free account benefits
Turn practice into measurable progress
Public PYQs and reference pages stay free. Sign in when you want GATEverse to remember what you studied and guide what to practise next.