- The following code has O(logN) time complexity.
- The concept is to divide the number recursively and displays the result
- The following function void base(int num,int n) prints the output.
void base(int num,int n) //num is the given number , n is 2
{ if(num>1)
base(num/n,n);
printf("%d",num%n);
}
No comments:
Post a Comment