Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Node* SearchMax()
- {
- Node* tmp = head->Next;
- Node* address = head;
- int max = head->Value;
- while (tmp != nullptr)
- {
- if (max < tmp->Value)
- {
- max = tmp->Value;
- address = tmp;
- }
- tmp = tmp->Next;
- }
- max = head->Value;
- head->Value = address->Value;
- address->Value = max;
- return nullptr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement