Re: [algogeeks] Re: Probability Puzzle

2011-08-09 Thread Vanathi Arivazhagan
If we are selecting a new coin after getting five consecutive heads, then the probability of getting a sixth head is same as getting the first head. But we are tossing the same coin again. So, conditional probability has to be used. -- Regards, Vanathi -- You received this message because yo

Re: [algogeeks] Recursive version of reversing linked list

2011-07-30 Thread Vanathi Arivazhagan
int set = 0; > struct node * Rec_Reverse(struct node *p, struct node *q) > { > >static struct node *r; >if(q->next!=NULL) > Rec_Reverse(p->next,q->next); >if(set == 0) > {r=q; > set++; > } >q->next = p; >p->next=NULL; >

Re: [algogeeks] Recursive version of reversing linked list

2011-07-30 Thread Vanathi Arivazhagan
struct node * Rec_Reverse(struct node *p, struct node *q) { static struct node *r; if(q->next!=NULL) Rec_Reverse(p->next,q->next); if(set == 0) {r=q; set++; } q->next = p; p->next=NULL; return r; } This method has