@ankit can you be please specific and i would encourage people to come up with solution and then we can discuss.But you can always ask solution to specific questions...:)
Given an integer n, write a function that returns count of trailing zeroes in n!. Examples: Input: n = 5 Output: 1 Factorial of 5 is 20 which has one trailing 0. Input: n = 20 Output: 4 Factorial of 20 is 2432902008176640000 which has 4 trailing zeroes. Input: n = 100 Output: 24
recursive approach:
ReplyDeleteStruct node * convert(int arr[],int start,int end)
{
if(start>end) return NULL;
else
{
int mid=(start+end)/2;
struct node* root=new node;
root->data=arr[mid];
root->left=convert(arr,start,mid-1);
root->right=convert(arr,mid+1,end);
return root;
}
}
@ankit correct...
ReplyDelete@Priyaranjan could you please give the solution for other questions that have not been solved yet??.....
ReplyDelete@ankit can you be please specific and i would encourage people to come up with solution and then we can discuss.But you can always ask solution to specific questions...:)
ReplyDelete