|
Prev: Scattered-write with sendto() un a SOCK_DGRAM Unix Domain Socket
Next: acheter lipitor soft sans prescription achat lipitor belgique en ligne Achetez achat lipitor acheter lipitor acheter lipitor canada commander en ligne
From: Rahul on 6 May 2008 09:27 Hi Everyone, I was trying out the following problem in recursive approach 10 4 12 6 7 So the link should be 10->4->6->7->12 I developed the following code, for this, void single(struct node * root, struct node * parent) { if(root == NULL) return; root->link = NULL; if(parent != NULL) parent->link = root; single(root->lptr,root); if(root->lptr != NULL) { struct node * temp = root->lptr; while(temp->rptr!= NULL) temp = temp->rptr; single(root->rptr,temp); } else single(root->rptr,root); } But i felt this to be a bit clumsy although logic seems fine... is there any scope to improve the logic? |