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.
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.
node * bst(node *p,node *parent=null){
ReplyDeletenode *q=null,*prev,*next,*t;
if(p==null)
return q;
bst(p->left,parent);
t=malloc(sizeof(node));
t->prev=null;
t->next=null;
t->value=p->value;
parent=t;
if(q==null)
{q=t;
}
else{
parent->next=t;
t->prev=parent;
t->next=null;
}
bst(p->right,parent);
return q;
}
http://cslibrary.stanford.edu/109/TreeListRecursion.html#c
ReplyDelete