what will be the time complexity if we solve it using recursion.
will the time complexity be o(n) ? .
i have solved it using recursion
#include <bits/stdc++.h>
using namespace std;
void _pair(int a[], int n, int key)
{
if (n == 1)
{
return;
}
int fe = a[0];
for (int i = 1; i < n; i++)
{
if (fe + a[i] == key)
{
cout << fe << “,” << a[i] << endl;
break;
}
}
_pair(a + 1, n - 1, key);
}
int main()
{
int a[8] = {1, 3, 5, 7, 10, 11, 12, 13};
int key = 16;
_pair(a, 8, key);
return 0;
}