Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void unflattenList(Node *head, Node **tail){
- recursiveUnflatten(head);
- Node *cur=head;
- while(cur->next)
- cur=cur->next;
- *tail=cur;
- }
- void recursiveUnflatten(Node *child){
- Node *cur=child;
- while(cur){
- if(cur->child){
- //break link
- ((cur->child)->prev)->next=NULL;
- (cur->child)->prev=NULL;
- //recursion
- recursiveUnflatten(cur->child);
- }
- cur=cur->next;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement