// MergeSort 30.08 0055.cpp : Ten plik zawiera funkcję „main”. W nim rozpoczyna się i kończy wykonywanie programu. // #include using namespace std; struct node { int val; node* next; }; void add(node*& H, int x) { node* p = new node; p->val = x; p->next = H; H = p; } void del(node*& H) { if (H != NULL) { node* p = H; H = H->next; delete p; } } int count(node*& H) { node* p = H; int n = 1; while (p != NULL) { n++; p = p->next; } return n; } int half(node*& H, int x) { if (H != NULL) { node* slow = H; count(x); for (int i = 0; i < x; i++) { slow = slow->next; } } return slow; //potrzebuje zwrocic wskaznik na element ktory jest polowa listy } void show(node* H) { node* p = H; if (H != NULL) { node* p = H; cout << "->" << p->val; H = H->next; } else cout << "NULL" << endl; } void merge(node*& H) { node* front = H; int x = half(H, count(H)); } int main() { }