@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...:)
You are given n real numbers in an array. A number in the array is called a decimal dominant if it occurs more than n/10 times in the array. Give an O(n) time algorithm to determine if the given array has a decimal dominant.
Implement a function getbits, that returns the(right adjusted) n bits that begin at position p of an integer. Assume bit position 0 is at the right end and that n and p are sensible positive values.
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