Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void split(Node *&h,Node *& first,Node *&second)
- {
- Node * p=h;
- Node * iterator=h;
- first= nullptr;
- second = nullptr;
- int i=0;
- while(p!= nullptr) // policz liczbę elementów
- {
- p=p->next;
- i++;
- }
- i/=2;
- while(i!=0)
- {
- i--;
- add(first,iterator->val);
- iterator=iterator->next;
- }
- while(iterator!= nullptr)
- {
- add(second,iterator->val);
- iterator=iterator->next;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement